解题思路:
注意事项:
参考代码:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
int i,m;
int letter=0;
int space=0;
int num=0;
int other=0;
char str[100];
gets(str);
m=strlen(str);
for(i=0; i<m; i++)
{
if((str[i]>=65&&str[i]<=90)||(str[i]>=97)&&(str[i]<=122))
letter++;
else if(str[i]==' ')
space++;
else if(str[i]>=48&&str[i]<=57)
num++;
else
other++;
}
printf("%d %d %d %d\n",letter,space,num,other);
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题7.1 (C语言代码)浏览:722 |
C语言程序设计教程(第三版)课后习题12.6 (C语言代码)浏览:791 |
C语言程序设计教程(第三版)课后习题3.7 (C语言代码)浏览:732 |
C语言程序设计教程(第三版)课后习题8.4 (C语言代码)浏览:611 |
字符串对比 (C语言代码)浏览:1398 |
大神老白 (C语言代码)浏览:640 |
【偶数求和】 (C语言代码)浏览:556 |
Minesweeper (C语言描述,蓝桥杯)浏览:1122 |
核桃的数量 (C语言代码)浏览:668 |
C语言程序设计教程(第三版)课后习题9.3 (C语言代码)浏览:593 |