对于这个程序的while循环我有点不明白,它是对单词的统计,请指教
#include <iostream.h>
#include <string.h> // prototype for strcmp()
const int STR_LIM = 50;
int main()
{
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 <string.h> // prototype for strcmp()
const int STR_LIM = 50;
int main()
{
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;
}