C++6.0问题

来源:百度知道 编辑:UC知道 时间:2024/06/04 09:10:21
#include <stdio.h>
void main()
{
char c;
int letter=0,space=0,digit=0,other=0;
printf("请输入一行字符:\n");
while((c=getchar())!='\n')
{
if(c>='a'&&c<='z'||c>='A'&&c<='Z')
letter++;
else if(c==")
space++;
else if(c>='0'&&c<='9')
digit++;
else
other++;
}
printf("字母数=%d,空格数=%d,数字数=%d,其他字符数=%d\n",letter,space,digit,other);
}
N哪儿错了
改完以后还是有一个地方错了

细节问题,else if(c==")
应该是两个单引号''而不是一个左双引号。

。。。。。程序能跑通。。只有一个地方,
else if(c==")
space++;
这是什么意思?空格吗?那应该是 c==' ' ,怎么是一双引号?