#include<iostream>#include<cctype>#include<string>using namespace std;int main(){ cout << "Enter words (q to quit);"<<endl; char words[20]; int count1 = 0; int count2 = 0; int count3 = 0; while (cin >> words) { if (isalpha(words[0])) { if (words[0] == 'a' || words[0] == 'e' || words[0] == 'i' || words[0] == 'o' || words[0] == 'u' || words[0] == 'A' || words[0] == 'E' || words[0] == 'I' || words[0] == 'O' || words[0] == 'U') count1++; else if (words[0] == 'q'&&strlen(words) == 1) break; else count2++; } count3++; } cout << "元音:" << count1 << endl << "辅音:" << count2 << endl << "其他:" << count3 << endl; return 0;}下面程序运行时只有输入,一直再让输入,而不输出,什么情况
2 回答
- 2 回答
- 0 关注
- 2186 浏览
添加回答
举报
0/150
提交
取消