求高手指点一个c++ 问题
统计元音字母出现的次数#include<iostream>
using namespace std;
int main()
{
char ch;
int aCnt = 0, eCnt = 0, iCnt = 0,
oCnt = 0, uCnt = 0;
while(cin >> ch){
switch(ch){
case 'A':
case 'a':
++aCnt;
break;
case 'E':
case 'e':
++eCnt;
break;
case 'I':
case 'i':
++iCnt;
break;
case 'O':
case 'o':
++oCnt;
break;
case 'U':
case 'u':
++uCnt;
break;
}
}
cout << "Number of vowel a: \t" << aCnt << '\n'
<< "number of vowel e: \t" << eCnt << '\n'
<< "Number of vowel i: \t" << iCnt << '\n'
<< "Number of vowel o: \t" << oCnt << '\n'
<< "Number of vowel u: \t" << uCnt << endl;
return 0;
}
如何跳出while循环并执行后面的语句,我已经试过按ctrl+z 但是还是不行 ,请高手指点