我家的宝贝四千金:帮我写个c语言的题目

来源:百度文库 编辑:中科新闻网 时间:2024/04/26 09:22:36
帮帮忙
输入一行字符,分别统计出其英文字母 空格 数字和其他字符的个数?

分太少,题太麻烦

输入一行字符,分别统计出其英文字母、空格、数字和其他字符的个数

main()
{ int t1=0,t2=0,t3=0,_t=0;
char a;
clrscr();
scanf("%c",&a);

while (a!='\n')
{
if (a>=48&&a<=57) t1++;
else if ((a>=65&&a<=90)||(a>=97&&a<=122)) t2++;
else if (a==' ') _t++;
else t3++;

scanf("%c",&a);
}
printf("\nnumbers=%d letters=%d signs=%d blank space=%d\n",t1,t2,t3,_t);
}

http://www.h4cker.org/user1/542/archives/2006/4165.shtml

呵呵,没资金,不感兴趣