编写一个程序,从键盘输入一行字符按Enter键结束分别统计并输出出英文字母、空格、数字及其他字符的个数。
编写一个程序,从键盘输入一行字符按Enter键结束分别统计并输出出英文字母、空格、数字及其他字符的个数。
日期:2009-03-20 17:25:47 人气:1
楼上的数字也要用字符形式哦.
#include
int main()
{
int letters,space,digit,other;
char c;
letters=0,space=0,digit=0,other=0;
while((c=getchar())!='\n')
{if(c>='a'&&c='A'&&c<='Z')
letters ++;
else if(c>=