最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

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

求大神修改

求大神修改

C
慕移動(dòng)9341187 2015-12-11 11:12:02
#include<stdio.h>#define N 40int ReadScore(int score[],long num[]);void DataSort(int score[],long num[],int n);void printfscore(int score[],long num[],int n);int main(){? ? int n,score[N];? ? long num;? ? ReadScore(score,num);? ? printf("Total students'ID and students are %d\n",num,n);? ? DataSort(score,num,n);? ? printf("Sorted score:");? ? printfscore(score,num,n);? ? return 0;}int ReadScore(int score[],long num[]){? ? int i=-1;? ? do? ? {? ? ? ? i++;? ? ? ? printf("Input students'ID and score:");? ? ? ? scanf("%ld%d",&num[i],&score[i]);? ? }while(score[i]>=0&&num[i]>0);? ? return i;}void DataSort(int score[],long num[],int n){? ?int i,j,k;? ?int temp1;? ?long temp2;? ?for(i=0;i<n-1;i++)? ?{? ? ? ?k=i;? ? ? ?for(j=i+1;j<n;j++)? ? ? ?{? ? ? ? ? ?k=j;? ? ? ?}? ? ? ?if(k!=1)? ? ? ?{? ? ? ? ? ?temp1=score[k];score[i]=score[k];score[i]=temp1;? ? ? ? ? ?temp2=num[k];num[k]=num[j];num[j]=temp2;? ? ? ?}? ?}}void printfscore(int score[],long num[],int n){? ? int i;? ? for(i=1;i<n;i++)? ? {? ? ? ? printf("%ld%d\n",num[i],score[i]);? ? }? ? printf("\n");}
查看完整描述

2 回答

已采納
?
流浪_老

TA貢獻(xiàn)71條經(jīng)驗(yàn) 獲得超14個(gè)贊

#include<stdio.h>

#define N 40

int ReadScore(int score[],long num[]);

void DataSort(int score[],long num[],int n);

void printfscore(int score[],long num[],int n);

int main()

{

? ? int n,score[N];

? ? long num[N];

? ? ReadScore(score,num);

? ? printf("Total students'ID and students are %d\n",num,n);

? ? DataSort(score,num,n);

? ? printf("Sorted score:");

? ? printfscore(score,num,n);

? ? return 0;

}

int ReadScore(int score[],long num[])

{

? ? int i=-1;

? ? do

? ? {

? ? ? ? i++;

? ? ? ? printf("Input students'ID and score:");

? ? ? ? scanf("%ld%d",&num[i],&score[i]);


? ? }while(score[i]>=0&&num[i]>0);

? ? return i;

}

void DataSort(int score[],long num[],int n)

{

? ?int i,j,k;

? ?int temp1;

? ?long temp2;

? ?for(i=0;i<n-1;i++)

? ?{

? ? ? ?k=i;

? ? ? ?for(j=i+1;j<n;j++)

? ? ? ?{

? ? ? ? ? ?k=j;

? ? ? ?}

? ? ? ?if(k!=1)

? ? ? ?{

? ? ? ? ? ?temp1=score[k];score[i]=score[k];score[i]=temp1;

? ? ? ? ? ?temp2=num[k];num[k]=num[j];num[j]=temp2;

? ? ? ?}


? ?}



}


void printfscore(int score[],long num[],int n)

{

? ? int i;

? ? for(i=1;i<n;i++)

? ? {

? ? ? ? printf("%ld%d\n",num[i],score[i]);

? ? }

? ? printf("\n");

}


查看完整回答
反對(duì) 回復(fù) 2015-12-11
?
Jason333

TA貢獻(xiàn)31條經(jīng)驗(yàn) 獲得超0個(gè)贊

long num; ?改成 long num[N];?

查看完整回答
反對(duì) 回復(fù) 2015-12-11
  • 2 回答
  • 0 關(guān)注
  • 2113 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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