用户通过键盘输入一串字符,该字符串以回车键结束输入,
发布网友
发布时间:2022-04-21 21:01
我来回答
共2个回答
热心网友
时间:2023-06-19 13:03
灞曞紑鍏ㄩ儴#include<stdio.h>
int main()
{
int alph = 0, num = 0, space = 0, other = 0;
char c;
while ((c=getchar()) != '\n')
{
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
alph ++;
else if (c >= '0' && c <= '9')
num ++;
else if (c == ' ')
space ++;
else
other ++;
}
printf("1001 static:\n");
printf("There are %d Alphabet Characters.\n", alph);
printf("There are %d Number Characters.\n", num);
printf("There are %d Space Characters.\n", space);
printf("There are %d Other Characters.\n", other);
return 0;
}
鏈夐棶棰樺啀鑱旂郴~
热心网友
时间:2023-09-15 14:20
#include<stdio.h>
int main()
{
int alph = 0, num = 0, space = 0, other = 0;
char c;
while ((c=getchar()) != '\n')
{
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
alph ++;
else if (c >= '0' && c <= '9')
num ++;
else if (c == ' ')
space ++;
else
other ++;
}
printf("1001 static:\n");
printf("There are %d Alphabet Characters.\n", alph);
printf("There are %d Number Characters.\n", num);
printf("There are %d Space Characters.\n", space);
printf("There are %d Other Characters.\n", other);
return 0;
}
有问题再联系~
热心网友
时间:2023-09-15 14:21
其实很简单!你也太懒了吧?直接把作业题发上来了 ?追问我有什么办法?每回总是差一个数。。。。快蛋疼死了