>>有机会了再挨行解释吧
.cpp
#include <iostream>
#include "sort.h"
using namespace std;
int main()
{
int a1[9]={3,2,4,5,6,7,8,9,1};
cout<<"输出一个a1数组"<<endl;
for(int i=0;i<9;i++){
cout<<a1[i];}
cout<<endl ;
cout<<"元素4在数组中的位置为:"<<endl;
cout<<BinarySearch(a1,4,9)<<endl;
int a2[9]={3,5,1,7,9,4,6,8,2};
int b[9];
cout<<"输出一个a2数组"<<endl;
for(int i=0;i<9;i++){
cout<<a2[i];}
cout<<endl ;
cout<<"合并排序之后的a2数组为"<<endl;
MergeSort(a2,b,0,8);
for(int i=0;i<9;i++){
cout<<a2[i];
}
cout<<endl ;
int a3[9]={5,3,6,1,8,7,9,2,4};
cout<<"输出一个a3数组"<<endl;
for(int i=0;i<9;i++){
cout<<a3[i] ;}
cout<<endl ;