#include<stdio.h>
int main()
{
char ch;
int letters = 0, digit = 0, space = 0, others = 0;
printf(“input some charaters:”);
ch = getchar();
while(ch!=’\n’)
{
if (ch >= ‘a’ && ch <= ‘z’||ch>=‘A’&&ch<=‘Z’)
letters++;
else if (ch >= ‘0’ && ch <= ‘9’)
digit++;
else if (ch == ’ ')
space++;
else
others++;
ch = getchar();
}
printf(“zi mu you%d\nshu zi you%d\nkong ge you%d\nfu hao you%d\n”,letters,digit,space,others);
return 0;
}
从0开始系列day2(下次弄个优化电脑的Advanced的学习版不知道能不能过)
于 2022-03-19 22:22:43 首次发布