while循环完全没必要, 先执行scanf获得n的值, 然后for循环n次即可.
你是不是要输出两个名字换行啊用一个for循环即可int m=0;for (i=0;ifor(;m<2;m++) printf("%s %s %d\n",s[i].num,s[i].name,s[i].g);