#include <iostream>
#include <cstring> // prototype for strcmp()
const int STR_LIM = 50;
int main()
{
using namespace std;
char word[STR_LIM];
int count = 0;
cout << "Enter words (to stop, type the word done):\n";
while (cin >> word && strcmp("done", word))
++count;
cout << "You entered a total of " << count << " words.\n";
return 0;
}
#include<iostream>
using namespace std;
int main(){
string word;
int count = 0;
cout << "Enter words (to stop, type the word done):\n";
while (cin >> word &&! (word=="done"))
++count;
cout << "You entered a total of " << count << " words.\n";
return 0;
}