第十三周專案四 陣列的排序(選擇排序按降序排列)

2021-06-27 04:54:30 字數 633 閱讀 7539

問題及**:

#include using namespace std;

void select_sort(int s,int num);

void output_array(int s,int num);

//兩個函式bubble_sort和output_array的宣告

int main( )

; int b[15]= ;

select_sort(a,20); //用選擇排序法按降序排序a中元素

output_array(a,20); //輸出排序後的陣列

select_sort(b,15); //用選擇排序法按降序排序b中元素

output_array(b,15); //輸出排序後的陣列

return 0;

}//請在下面定義bubble_sort和output_array函式

void select_sort(int s,int num)

{ for (int a=0; a

執行結果:

第十三周 專案四 陣列的排序(1 4選擇排序)

問題及 檔名稱 project4.cpp 作 者 李楠 完成日期 2014年11月21日 版 本 號 v1.0 問題描述 編寫程式,完成選擇排序 輸入描述 略 程式輸出 略 include using namespace std void select sort int p,int n void o...

第十三周專案 4 陣列的排序(選擇排序)

檔名稱 main.cpp 作 者 韓娟 完成日期 2014年11月22日 版 本 號 v1.0 問題描述 編寫函式,完成選擇排序 輸入描述 略 程式輸出 字母降序排序 include include using namespace std void select sort int y,int n v...

第十三周 專案四 陣列的排序(1 1)

問題及 檔名稱 project4.cpp 作 者 李楠 完成日期 2014年11月20日 版 本 號 v1.0 問題描述 編寫程式,完成氣泡排序 輸入描述 略 程式輸出 略 include include using namespace std void bubble sort int p,int ...