|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
#include<stdio.h>
int main()
{
int i, j, o = 0, p = 0;
char a[20], num[20], n[20], m[20];
printf("input 20 charaters\n");
for (i = 0; i < 20; i++)
{
scanf_s("%c", &a[i]);
}
for (j = 0; j < 20; j++)
{
if ('0' < a[j] < '9')
{
num[j] = a[j];
}
else if ('a' < a[j] < 'z' || 'A' < a[j] < 'Z')
{
m[o] = a[j];
o++;
}
else
{
n[p] = a[j];
p++;
}
}
printf("the numbers is ");
for (i = 0; i < 20; i++)
{
printf("%c", num[i]);
}
printf("\n");
printf("the char is ");
for (i = 0; i < 20; i++)
{
printf("%c", m[i]);
}
printf("\n");
printf("the others is");
for (i = 0; i < 20; i++)
{
printf("%c", n[i]);
}
printf("\n");
system("pause");
return 0;
}
这个程序是想统计输入的字符 但我得不到想要的结果 字符的学习内容忘掉了 |
|