#define _CRT_SECURE_NO_WARNINGS 1
#include
int main()
{
int i,j,upr,lwr,num,span,other;
i = j = upr = lwr = num = span = other = 0;
char text[3][60];
for (i = 0; i < 3; i++)
{
printf("Please input line %d:", i + 1);
gets(text[i]);
for (j = 0; text[i][j] != '\0'; j++)
{
if (text[i][j] >= 'A' && text[i][j] <= 'Z')
upr++;
else if (text[i][j] >= 'a' && text[i][j] <= 'z')
lwr++;
else if (text[i][j] >= '0' && text[i][j] <= '9')
num++;
else if (text[i][j] = ' ')
span++;
else
other++;
}
}
puts("\nCount up:");
printf("大写字母:%d个\n", upr);
printf("小写字母:%d个\n", lwr);
printf("数字:%d个\n", num);
printf("空格:%d个\n", span);
printf("其他:%d个\n", other);
return 0;
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35