#include
int number(char c) {
int letter=0,number=0,kong=0,other=0;
while((c=getchar())!='\n'){
if((c>='a'&&c
else if(c>='0'&&c<='9') number++;
else if(c==' ') kong++;
else other++;
}
printf("%d %d %d %d",letter,number,kong,other);
return 0;
}
int main(){
char c;
c=getchar();
number(c);
}
是因为在int main部分上多写getchar(),就在number函数接受char c字符是总会是你从键盘输入的第一个字符类型减-1
0.0分
1 人评分
C语言训练-大、小写问题 (C语言代码)浏览:2389 |
Pascal三角 (C语言代码)浏览:1208 |
用筛法求之N内的素数。 (C语言代码)浏览:1288 |
printf基础练习2 (有点不明白)浏览:850 |
完数 (C语言代码)浏览:714 |
最小公倍数 (C语言代码)浏览:1041 |
母牛的故事 (C语言代码)浏览:718 |
C语言程序设计教程(第三版)课后习题4.9 (C语言代码)浏览:710 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:559 |
字符逆序 (C语言代码)浏览:631 |