请教问题

来源:互联网 发布:矩阵测光特点 编辑:程序博客网 时间:2024/04/30 23:44
 
 对于这个程序的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;
}
原创粉丝点击