#include<iostream> using namespace std; #define SIZE 21 typedef int Sqlist[SIZE]; void InsretSort(Sqlist &L,int n) { for(int i=2;i<n;++i) { L[0] = L[i]; for(int j=i;L[0] < L[j-1];--j) { L[j] = L[j-1]; } L[j] = L[0]; } } void main() { Sqlist L= {0,49,38,65,97,76,13,27}; InsretSort(L,8);//直接插入 for(int i=1;i<8;++i) cout<<L[i]<<" "; cout<<endl; }