解题思路:
注意事项:
参考代码:
#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 人评分
C语言训练-邮票组合问题* (C语言代码)......浏览:678 |
弟弟的作业 (C++代码)浏览:1335 |
大小写转换 (C语言代码)浏览:899 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:465 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C语言代码)浏览:627 |
WU-整除问题 (C++代码)浏览:640 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:682 |
IP判断 (C语言代码)浏览:814 |
C语言程序设计教程(第三版)课后习题9.6 (C语言代码)浏览:590 |
C语言程序设计教程(第三版)课后习题8.7 (C语言代码)浏览:604 |