求帮看下这哪里错了 北邮oj的108虚数题http://code.bupt.edu.cn/problem/p/108/
#include <stdio.h>
#include <math.h>
#include <string.h>
struct num{
int a , b ;
char ch ;
double mo ;
} x[105] ;
int cmp(const void*x , const void*y){
const struct num *p = x ;
const struct num *q = y ;
return p->mo - q->mo ;
}
int main(){
char com[10] , ch1 ;
int t , n ;
int i , j ;
while(scanf("%d" , &t) != EOF){
while(t-- > 0){
scanf("%d" , &n) ;
j = 0 ;
i = 0 ;
while(j < n){
scanf("%s" , com) ;
if(0 == strcmp(com , "Insert")){
scanf("%d%c%c%d" , &x[i].a ,&x[i].ch , &ch1 , &x[i].b) ;
x[i].mo = sqrt( x[i].a*x[i].a + x[i].b*x[i].b ) ;
i ++ ;
printf("Size: %d\n" , i) ;
}else if(0 == strcmp(com , "Pop")){
if(0 == i){
printf("Empty!\n") ;
}else {
qsort(x , i , sizeof(struct num) , cmp) ;
printf("%d%ci%d\n" , x[i-1].a , x[i-1].ch , x[i-1].b) ;
i -- ;
if(0 != i){
printf("Size: %d\n" , i) ;
}else {
printf("Empty!\n") ;
}
}
}
j ++ ;
}
}
}
return 0 ;
}