解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<string.h>
int main()
{
int letter=0,number=0,space=0,other=0;
char str[100];
gets(str);
for(int i=0;i<strlen(str);i++)
{
if(str[i]>='a'&&str[i]<='z'||str[i]>='A'&&str[i]<='Z')
letter++;
else if(str[i]>='0'&&str[i]<='9')
number++;
else if(str[i]==' ')
space++;
else
other++;
}
printf("%d %d %d %d",letter,number,space,other);
return 0;
}
0.0分
1 人评分
不知道哪里错了浏览:1148 |
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:1050 |
妹子杀手的故事 (C语言代码)浏览:691 |
简单的a+b (C语言代码)浏览:546 |
【出圈】 (C语言代码)浏览:560 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:553 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:768 |
拆分位数 (C语言代码)浏览:1328 |
P1001 (C语言代码)浏览:803 |
【蟠桃记】 (C语言代码)浏览:667 |