I am having troubles how to start creating program which counts letters in words in .txt file and print it if letter number is > 20.. Does someone know how to start or have some similar program to help me..Thank you
Just to show an example, because I don't think the tutorial shows a good example that uses >> for input.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// Example program
#include <iostream>
#include <string>
#include <fstream>
int main()
{
// Assumes file has words separated by whitespace
std::ifstream file("words.txt");
// read in a word
std::string word;
file >> word; // operator>> separates each word by whitespace
// print length
std::cout << word.length() << '\n';
}