解题思路:
注意事项:
参考代码:
#include<string.h>
int main()
{
char str[1024];
char* p;
int count1=0,count2=0,count3=0,count4=0;
gets(str);
p=str;
while(*p!='\0')
{
if(*p>='a'&&*p<='z'||*p>='A'&&*p<='Z')
{
count1++;
}
else if(*p>='0'&&*p<='9')
{
count2++;
}
else if(*p==' ')
{
count3++;
}
else
{
count4++;
}
p++;
}
printf("%d %d %d %d",count1,count2,count3,count4);
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题9.8 (C语言代码)浏览:599 |
输出九九乘法表 (C语言代码)浏览:555 |
矩形面积交 (Java代码)浏览:1214 |
买不到的数目 (C++代码)浏览:864 |
A+B for Input-Output Practice (VII) (C++代码)浏览:609 |
【亲和数】 (C语言代码)浏览:492 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:1238 |
C语言程序设计教程(第三版)课后习题6.11 (C语言代码)浏览:549 |
A+B for Input-Output Practice (III) (C语言代码)浏览:565 |
矩形面积交 (C++代码)浏览:1127 |