标签:hdu
2 aeiou my name is ignatius
a:1 e:1 i:1 o:1 u:1 a:2 e:1 i:3 o:0 u:1
#include<iostream> using namespace std; int main() { char str[100]; int a,e,i,o,u,n,k; cin >> n; cin.get();//清除缓冲区的换行符 while(n--) { a = e = i = o = u = 0; cin.getline(str,100); for(k = 0;str[k];k++) { switch(str[k]) { case'a':a++;break; case'e':e++;break; case'i':i++;break; case'o':o++;break; case'u':u++;break; } } cout << "a:" << a << endl; cout << "e:" << e << endl; cout << "i:" << i << endl; cout << "o:" << o << endl; cout << "u:" << u << endl; if(n) cout << endl; } }
标签:hdu
原文地址:http://blog.csdn.net/xiaotan1314/article/details/46239877