统计元音
#include<stdio.h> #include<string.h> int main( ) { int N; scanf("%d",&N); getchar(); while(N--) { char ch[300]; gets(ch); int i,j,len,a=0,e=0,t=0,o=0,u=0; len=strlen(ch); for(i=0;i<len;i++) if(ch[i]=='a') a++; else if(ch[i]=='e') e++; else if(ch[i]=='i') t++; else if(ch[i]=='o') o++; else if(ch[i]=='u') u++; printf("a:%d\ne:%d\ni:%d\no:%d\nu:%d",a,e,t,o,u); printf(N?"\n\n":"\n"); } return 0; }
posted on 2011-04-28 20:10 more think, more gains 阅读(143) 评论(0) 编辑 收藏 举报