#include <iostream>
#include <string>
usingnamespace std;
int main()
{
int N;
cout << "How many words do you want to enter:\n";
cin >> N;
cout << "OK; enter " << N << " words. It doesn't matter if there is more than one per line.\n";
int counter = 0;
for ( int i = 0; i < N; i++ )
{
string word;
cin >> word;
if ( word.find_first_not_of( "0123456789" ) == string::npos && stoi( word ) < 1000 ) counter++;
}
cout << "There are " << counter << " numbers less than 1000\n";
}
How many words do you want to enter:
7
OK; enter 7 words. It doesn't matter if there is more than one per line.
How
many
7
more
42
times
9000
There are 2 numbers less than 1000