解题思路:
注意事项:
参考代码:
#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语言训练】求PI* (C语言代码)浏览:675 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:403 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:472 |
数列 (C++代码)浏览:504 |
川哥的吩咐 (C语言代码)浏览:664 |
简单的a+b (C语言代码)浏览:513 |
C语言程序设计教程(第三版)课后习题5.8 (C语言代码)浏览:474 |
简单的a+b (C语言代码)浏览:404 |
C语言程序设计教程(第三版)课后习题8.8 (C语言代码)浏览:1238 |
【计算球体积】 (C语言代码)浏览:800 |