问题遇到的现象和发生背景 出现了奇怪的乱码现象,求解答。输入helLo 3133 YOunG enGineER(无报错
)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main()
{
char t[110];
printf("Input a zifu:");
gets(t);
int i = 1;
if (t[0] !=' ' && t[0] >= 'a')
t[0] = t[0] - 32;
while (t[i] != '\0')
{
if (t[i - 1] == ' ' && t[i] >= 'a')
{
t[i] = t[i] - 32;
}
else if(t[i - 1] !=' ' && t[i] >= 'A')
t[i] = t[i] +32;
else if(t[i-1]!=' '&&t[i]>='a')
t[i]=t[i];
else if(t[i]<='9'&&t[i]>='0')
t[i] = t[i]-1;
i++;
}
printf("%s", t);
system ("pause");
}