第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

關(guān)于結(jié)構(gòu)體的冒泡排序問(wèn)題

關(guān)于結(jié)構(gòu)體的冒泡排序問(wèn)題

C
qq_新生_10 2018-03-12 20:25:33
這是正確的代碼:#include<stdio.h>#include<stdlib.h>struct student{ int ? ? number; char ? ?name[20]; int ? ? score;}person[10];int main(){ struct student ?temp; int ? m,i,j,flag=1; scanf("%d",&m); for(i=0;i<m;i++)? ? ? ?{? ? ? ?scanf("%d %s %d",&person[i].number,person[i].name,&person[i].score);? ? ? ? ? } for(i=0;i<m-1;i++)? ? ? {? ? ? ?flag=1;? ? ? ?for(j=0;j<m-1-i;j++)? ? ? ? ? ?{? ? ? ? ? ? ? ? if(person[j].score>person[j+1].score)? ? ? ? ? ? ? {? ? ? ? ? ? ? ? temp=person[j+1];?? ? ? ? ? ? ? ? person[j+1]=person[j];? ? ? ? ? ? ? ? person[j]=temp;? ? ? ? ? ? ? ? ?flag=0;? ? ? ? ? ? ? } ?} if(flag==1) break; ? } for(i=0;i<m;i++) printf("%d %s %d\n",person[i].number,person[i].name,person[i].score); system("pause"); return 0;}然而當(dāng)for(j=0;j<m-1-i;j++)變?yōu)閒or(j=0;j<m-1;j++)時(shí)最后輸出結(jié)果時(shí),有一組結(jié)構(gòu)體數(shù)據(jù)會(huì)成為0 ?0,求大家指教,
查看完整描述

目前暫無(wú)任何回答

  • 0 回答
  • 0 關(guān)注
  • 1299 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)