sentinel.cpp

来自「C++&datastructure书籍源码,以前外教提供现在与大家共享」· C++ 代码 · 共 25 行

CPP
25
字号
#include <iostream>#include <string>using namespace std;   // count words in the standard input stream, cinint main(){    const string LAST_WORD = "end";        string word;    int numWords = 0;                  // initially, no words    cout << "type '" << LAST_WORD << "' to terminate input" << endl;        cin >> word;    while (word != LAST_WORD)          // read succeeded    {   numWords++;        cin >> word;    }    cout << "number of words read = " << numWords << endl;        return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?