#10.cpp
来自「c++编程的几个小例子」· C++ 代码 · 共 26 行
CPP
26 行
// STR_CNT.CXX : a word count program that uses stream i/o
#include <stream.hxx>
#include <ctype.h>
main()
{
int word_cnt = -1;
void found_next_word (void);
while ( cin.good() ) { // ^Z ends input
word_cnt++; // increment counts
found_next_word ();
}
cout << "word count is " << word_cnt << "\n";
}
void found_next_word (void)
{
char c;
cin >> c;
while (!isspace (c))
cin.get (c);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?