为什么输出一堆乱码 求助
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i;
int z[4];
char w[4];
int x[4];
for(i = 0;i < 4; i++){
scanf("%c",&w[i]);
x[i]=(w[i]-64);
switch(x[i]){
case 1:
z[i] = 8;
break;
case 2:
z[i] = 8;
break;
case 3:
z[i] = 12;
break;
case 4:
z[i] = 2;
break;
case 5:
z[i] = 2;
break;
case 6:
z[i] = 3;
break;
case 7:
z[i] = 14;
break;
case 8:
z[i] = 15;
break;
case 9:
z[i] = 6;
break;
case 10:
z[i] = 14;
break;
case 11:
z[i] = 14;
break;
case 12:
z[i] = 13;
break;
case 13:
z[i] = 1;
break;
case 14:
z[i] = 19;
break;
case 15:
z[i] = 16;
break;
case 16:
z[i] = 19;
break;
case 17:
z[i] = 3;
break;
case 18:
z[i] = 1;
break;
case 19:
z[i] = 11;
break;
case 20:
z[i] = 3;
break;
case 21:
z[i] = 19;
break;
case 22:
z[i] = 20;
break;
case 23:
z[i] = 22;
break;
case 24:
z[i] = 3;
break;
case 25:
z[i] = 13;
break;
case 26:
z[i] = 6;
break;
}
}
printf("%d\t",z[1]);
printf("%d\t",z[2]);
printf("%d\t",z[3]);
printf("%d\t",z[4]);
system("pause");
return 0;
}
输出结果只有第二个正常 怎么办