#include<stdio.h>
#include<string.h>
#define INPUT_COUNT (100)
#define DATA_NULL (char *)(0)
#define ERR (1u)
void main()
{
char inArray[INPUT_COUNT] = "";
int strType = 0;
int spaceType = 0;
int numType = 0;
int otherType = 0;
gets(inArray);
char *pRdData = inArray;
while(*pRdData != DATA_NULL)
{
if((*pRdData >= 'a' && *pRdData <= 'z') || (*pRdData >= 'A' && *pRdData <= 'Z'))
{
strType += 1;
}
else if(*pRdData == ' ')
{
spaceType += 1;
}
else if((*pRdData >= '0') && (*pRdData <= '9'))
{
numType += 1;
}
else
{
otherType += 1;
}
pRdData += 1;
}
printf("%d %d %d %d",strType,numType,spaceType,otherType);
}
0.0分
0 人评分
C二级辅导-同因查找 (C语言代码)浏览:537 |
C二级辅导-等差数列 (C++代码)浏览:2261 |
2005年春浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:747 |
字符串的输入输出处理 (C语言代码)浏览:2028 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:836 |
C语言训练-阿姆斯特朗数 (C语言代码)浏览:871 |
校门外的树 (C语言代码)浏览:1131 |
数组输出 (C语言代码)浏览:788 |
C语言训练-求s=a+aa+aaa+aaaa+aa...a的值 (C++代码)(手动优化一下计算)浏览:1316 |
Tom数 (C++代码)浏览:843 |