回覆列表
  • 1 # 使用者52510796211

    #defineN5#include"stdio.h"structstudent{intnum;intscore;};structstudents[N],temp;voidinput(){inti;for(i=0;i<N;i++){printf("Enternumber:");scanf("%d",&s[i].num);printf("Enterscore:");scanf("%d",&s[i].score);}}voidoutput(){inti;for(i=0;i<N;i++){//if(i%10==0)//是不是想利用變數i來控制換行?printf("num=%d\n,score=%d\n",s[i].num,s[i].score);}}voidmain(){voidinput();voidoutput();inti,j,b;input();for(i=0;i<N;i++){for(j=i+1;j<N;j++)if(s[i].score>s[j].score){temp=s[i];s[i]=s[j];s[j]=temp;}}output();}除錯正確

  • 中秋節和大豐收的關聯?
  • 紅蘿蔔燒牛肉正宗做法高壓鍋?