现在的位置: 首页 > 综合 > 正文

一种全局变量的定义方式m_Data

2013年03月27日 ⁄ 综合 ⁄ 共 361字 ⁄ 字号 评论关闭
我是一个学习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;
}

抱歉!评论已关闭.