解题思路:
注意事项:
参考代码:
#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语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:524 |
点我有惊喜!你懂得!浏览:1219 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:568 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:742 |
蛇行矩阵 (C语言代码)浏览:742 |
数组与指针的问题浏览:716 |
简单的a+b (C语言代码)浏览:524 |
C二级辅导-温度转换 (C语言代码)浏览:718 |
C语言程序设计教程(第三版)课后习题1.6 (C语言代码)浏览:662 |
矩阵的对角线之和 (C语言代码)浏览:1342 |