解题思路:
注意事项:
参考代码:
#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.10 (C语言代码)浏览:588 |
矩形面积交 (C语言代码)浏览:1480 |
C语言训练-斐波纳契数列 (C语言代码)浏览:2658 |
C语言程序设计教程(第三版)课后习题7.3 (C语言代码)浏览:618 |
成绩转换 (C语言代码)浏览:989 |
C语言程序设计教程(第三版)课后习题6.1 (C语言代码)浏览:640 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:563 |
GC的苦恼 (C语言代码)浏览:614 |
大神老白 (C语言代码)浏览:576 |
图形输出 (C语言代码)浏览:916 |