我是一个学习c++的新手,总有一些问题难住我。比如说如下的题目吧,它是一个对于单词统计的的简单程序,可是我看不懂其中的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 <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;
}