#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语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:692 |
人见人爱A+B (C语言代码)浏览:658 |
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:753 |
简单的a+b (C语言代码)浏览:1018 |
C二级辅导-计负均正 (C语言代码)浏览:517 |
C二级辅导-统计字符 (C语言代码)浏览:690 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:543 |
班级人数 (C语言代码)浏览:972 |
2003年秋浙江省计算机等级考试二级C 编程题(1) (C语言代码)浏览:848 |
C语言程序设计教程(第三版)课后习题10.7 指针(C语言代码)浏览:591 |