//4.
#include<stdio.h>
int main(void)
{
char a[20];
int b=0,c=0,d=0,e=0,i;
printf("请输入一串字符为15个\n ");
for (i = 0; i < 15; i++)
{
scanf_s("%c", &a[i]);
if (a[i] == 13) break;
}
for (i = 0; i < 15; i++)
{
if (a[i] >= 48 && a[i] <= 57)
b++;
if (a[i] >= 65 && a[i] <= 122)
c++;
if (a[i] == 32)
d++;
if (!((a[i] >= 48 && a[i] <= 57) || (a[i] >= 65 && a[i] <= 122)|| ( a[i] == 32)))
e++;
}
printf("数字%d\n字母%d\n空格%d\n其他字母%d\n", b, c, d, e);
return 0;
}
#include<stdio.h>
int main(void)
{
char a[20];
int b=0,c=0,d=0,e=0,i;
printf("请输入一串字符为15个\n ");
for (i = 0; i < 15; i++)
{
scanf_s("%c", &a[i]);
if (a[i] == 13) break;
}
for (i = 0; i < 15; i++)
{
if (a[i] >= 48 && a[i] <= 57)
b++;
if (a[i] >= 65 && a[i] <= 122)
c++;
if (a[i] == 32)
d++;
if (!((a[i] >= 48 && a[i] <= 57) || (a[i] >= 65 && a[i] <= 122)|| ( a[i] == 32)))
e++;
}
printf("数字%d\n字母%d\n空格%d\n其他字母%d\n", b, c, d, e);
return 0;
}