【C++ Primer Plus习题】5.8
问题:
解答:
#include <iostream>
#include <cstring>
using namespace std;#define SIZE 20int main()
{char words[20];char done[] = "done";int count = 0;while (true){cout << "请输入单词:" << endl;cin >> words;if (!strcmp(words, done))break;cin.get();count++;}cout << "在done前一共输入了" << count << "哥单词" << endl;return 0;
}
运行结果:

考查点:
- strcmp
2024年8月25日20:38:32

