#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++代码)(都当成字符串吧hhhhhhhh)浏览:494 |
九宫重排 (C++代码)浏览:2167 |
求圆的面积 (C语言代码)浏览:1307 |
C语言程序设计教程(第三版)课后习题8.3 (C语言代码)浏览:731 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:569 |
WU-格式化数据输出 (C++代码)浏览:1225 |
WU-整除问题 (C++代码)浏览:617 |
WU-C语言程序设计教程(第三版)课后习题11.12 (C++代码)(想学链表的小伙伴可以看看)浏览:920 |
C语言程序设计教程(第三版)课后习题5.5 (C语言代码)浏览:579 |
1128题解(返回值为数组的情况)浏览:486 |