牵连到指针问题,指针还没学
include <stdio.h>
include <string.h>
int main()
{
char ch[100];
printf("please input char:\n");
for (int i = 0; i < 100; i++)
{
scanf_s("%c", ch[i]);
}
for (int i = 0; i < 100; i++)
{
if ('a' <= ch[i] && ch[i] <= 'z')
{
ch[i] = ch[i] - 32;
}
else if ('A' <= ch[i] && ch[i] <= 'Z')
{
ch[i] = ch[i] + 32;
}
}
for (int i = 0; i < 100; i++)
{
printf("%c", ch[i]);
}
return 0;
}
回答
问题补充:
必须用scanf printf 输入输出