赞
踩
#include <stdio.h> int main(void) { int a_ct, e_ct, i_ct, o_ct, u_ct ; a_ct = e_ct = i_ct = o_ct = u_ct = 0; char ch; printf("Enter some text,enter # to quit.\n"); while ((ch = getchar()) != '#') { switch (ch) { case 'a': case 'A': a_ct++; break; case 'e': case 'E': e_ct++; break; case 'i': case 'I': i_ct++; break; case 'o': case 'O': o_ct++; break; case 'u': case'U': u_ct++; break; default: break; } } printf("Number of vowles:A E I O U\n"); printf(" %4d%4d%4d%4d%4d\n", a_ct, e_ct, i_ct, o_ct, u_ct); return 0; }
#include <stdio.h> //toupper()函数的库函数 #include <ctype.h> int main(void) { int a_ct, e_ct, i_ct, o_ct, u_ct ; a_ct = e_ct = i_ct = o_ct = u_ct = 0; char ch; printf("Enter some text,enter # to quit.\n"); while ((ch = getchar()) != '#') { ch = toupper(ch); switch (ch) { case 'A': a_ct++; break; case 'E': e_ct++; break; case 'I': i_ct++; break; case 'O': o_ct++; break; case'U': u_ct++; break; default: break; } } printf("Number of vowles:A E I O U\n"); printf(" %4d%4d%4d%4d%4d\n", a_ct, e_ct, i_ct, o_ct, u_ct); return 0; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。