麻烦大佬指出为啥输出乱码
题目[附件] [/附件]
我的代码
程序代码:
#include <stdio.h> #include <stdlib.h> #include <math.h> struct shot { char id[4]; int x; int y; }; int main(void) { struct shot people[10000]; float max=0,min=0; char *maxindex=NULL,*minindex=NULL; int num; scanf("%d",&num); for(int i=0;i<num;i++) { scanf("%s %d %d",people[i].id,&people[i].x,&people[i].y); float score = sqrt(people[i].y*people[i].y+people[i].x*people[i].x); if(i==0) { min = score; minindex =people[i].id; } if((float)score>max) { max = score; maxindex = people[i].id; } if(score<=min) { min = score; minindex = people[i].id; } } printf("%s %s\n",minindex,maxindex); system("pause"); return 0; }
乱码:
[此贴子已经被作者于2020-3-17 11:33编辑过]