编写程序:从键盘输入一串字符串,统计字符串中大写字母和小写字母的个数。

日期:2009-12-10 22:26:11 人气:2

编写程序:从键盘输入一串字符串,统计字符串中大写字母和小写字母的个数。

#include #include void main() { int i=0,count1[26]={0},count2[26]={0}; char ch[100]; printf("enter a sentence:"); gets( ch ); while( ch[i] ) {if(ch[i]>='a'&&ch[i]<='z') count1[ch[i]-'a']++; else if(ch[i
    A+
热门评论