#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int main()
{
string words;
int word_cnt=0;
int vowekls_cnt=0;
int consonants_cnt=0;
cout << "Enter words (q to quit): "<<endl;
while(cin>>words&&words[0] != 'q')
{
if(isalpha(words[0]))
{
if(words[0]=='a'||words[0]=='e'||words[0]=='i'||words[0]=='o'||words[0]=='u')
vowekls_cnt++;
else
consonants_cnt++;
}
else
word_cnt++;
}
cout << vowekls_cnt<<" words beginning with vowels;"<<endl
<<consonants_cnt << " words beginning with consnants;"<<endl
<< word_cnt << " others" <<endl;
return 0;
}
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交