亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么1,4,5函數輸出的是零啊

#include <stdio.h>

#include <string.h>

#include <stdlib.h>

#include <iostream>

#include <fstream>

int totalpoint(int score[])

{

? ? static int totalpoint;

? ? int i;

? ? for(i=0;i>9;i++)

? ? {

? ? ? ? totalpoint=score[i]+totalpoint;

? ? }

? ? printf("總分為%d分\n",totalpoint);

? ? return totalpoint;

}


int toppoint(int score[])

{

? ? int toppoint=score[0];

? ? int n;

? ? for(n=0;n<9;n++)

? ? {

? ? ? ? if(score[n]>toppoint)

? ? ? ? {

? ? ? ? ? ? toppoint=score[n];

? ? ? ? }

? ? }

? ? printf("最高分為%d分\n",toppoint);

? ? return toppoint;

}


int thelowestpoint(int score[])

{

? ? int lowpoint=score[0];

? ? int n;

? ? for(n=0;n<9;n++)

? ? {

? ? ? ? if(score[n]<lowpoint)

? ? ? ? {

? ? ? ? ? ? lowpoint=score[n];

? ? ? ? }

? ? }

? ? printf("最低分為%d分\n",lowpoint);

? ? return lowpoint;

}


int averagepoint(int score[])

{

? ? int i=totalpoint(score);

? ? int averagepoint=i/10;

? ? printf("平均分為%d分\n",averagepoint);

? ? return averagepoint;

}


int sort(int score[],int left,int right)

{

? ? int i,j,temp,k,e;

? ? i=left;

? ? j=right;

? ? temp=score[left];

? ? while(i!=j)

? ? {

? ? ? ? while(score[i]>temp&&i<j)

? ? ? ? j--;

? ? ? ? while(score[j]<temp&&i>j)

? ? ? ? i++;

? ? ? ? if(i<j)

? ? ? ? {

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

? ? ? ? ? ? score[i]=score[j];

? ? ? ? ? ? score[j]=k;

? ? ? ? }

? ? }

? ? score[i]=temp;

? ? score[left]=score[i];

? ??

? ? sort(score,left,i-1);

? ? sort(score,i+1,right);

? ??

? ? for(e=0;e<9;e++)

{

printf("數組排序后:%d",score);

}?

}

int main()

{

? ? int score[10]={67,98,75,63,82,79,81,91,66,84};

? ? totalpoint(score);

? ? toppoint(score);

? ? thelowestpoint(score);

? ? averagepoint(score);

? ? sort(score,0,9);

? ? return 0;

}



正在回答

1 回答

用的快速排序法

0 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么1,4,5函數輸出的是零啊

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號