#include<stdio.h>
int main(void)
{
int n,i,letter=0,number=0,blank=0,enter=0,other=0;
char op;
printf("enter n:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
op=getchar();
if((op>='a'&&op<='z')||(op>='A'&&op<='Z'))
letter++;
else if(op>='0'&&op<='9')
number++;
else if(op=='\n')
enter++;
else if(op==' ')
blank++;
else
other++;
}
printf("letter=%d,number=%d,enter=%d,blank=%d,other=%d\n",letter,number,enter,blank,other);
return 0;
}
这个程序我是这么运行的 但是letter为什么不是5而是4?
|