用C语言编写一个程序
用C语言编写一个程序:从键盘输入若干个字符,分别统计其中字母符号(区别大。小),数字字符和其他字符的
#include #include void main() { int i=0,n=0,m=0,j=0,k=0; char str[100]; printf("please input one string.\n"); scanf("%s",str); printf("\n"); while(str[i]!='\0') { if(str[i]>='a'&&str[i]='A'&&str[i]='0'&&str[i]<='9')j++; else k++; i++; } printf("小写字母:%d\n",n); printf("大写字母:%d\n",m); printf("数字:%d\n",j); printf("其他:%d\n",k); }
楼上的scanf("%s",str);函数是以空格或回车为中止符的,建议换个
问:我是个刚刚学c语言的学生有很多c语言的问题要大家帮忙解决
答:#include #include void main() {int a=0,b=0,c=0; char ch; //a为字母个数,b为数字个数,c为标点符号个...详情>>