c++求高手帮忙看看这个程序哪里有问题。。

2025-02-24 20:20:33
推荐回答(1个)
回答1:

#include
int main()
{
int a=0,b=0,c=0,d=0;
char x;
scanf("%c",&x);
for(int i=1;i<21;i++)
switch(x)
{case 'A':a++;break;
case 'B':b++;break;
case 'C':c++;break;
case 'D':d++;break;
}
printf("%d,%d,%d,%d\n",a,b,c,d);
}

The type of function main should be int, but some can be void.
The variable i has not declare.