报错,这个真把我搞懵了
程序代码:
#include "stdio.h" #include <string.h> #define p printf int main(void) {int l,n,s,o,sum,i;l=n=s=o=sum=0; char c[200];//说c未声明,,为什么啊? printf("Please input the string\n"); gets(c);//报错,, for(i=0;i<strlen(c);i++) {sum++; if((c[i]>=48)&&(c[i]<=57))n++; else if(c[i]==32)s++; else if(((c[i]>=65)&&(c[i]<=90))||((c[i]>=97)&&(c[i]<=122)))l++;//这些if语句有问题吗? else o++; } p("The summary is %d\n",sum); p("The number of letters is %d\n",l); p("The number of numbers is %d\n",n); p("The number of spacebars is %d\n",s); p("Other chars:%d\n",o); }