#include <iostream>
using namespace std;
#define MAXSIZE 20
typedef struct{
int key;
char *otherinfo;
}ElemType;
typedef struct{
ElemType *r;
int length;
}SqList;
//简单选择排序
void SelectSort(SqList &L) {
int i,j,k;
ElemType t;
for(i=1;i<L.length;++i){
k=i;
for(j=i+1;j<=L.length;++j)
if(L.r[j].key<L.r[k].key) k=j;
if(k!=i) {t=L.r[i];L.r[i]=L.r[k];L.r[k]=t;}
}
}
void Create_Sq(SqList &L){
int i,n;
cout<<"数据个数:";
cin>>n;
cout<<"待排序的数据:";
for(i=1;i<=n;i++){
cin>>L.r[i].key;
L.length++;
}
}
void show(SqList L){
int i;
for(i=1;i<=L.length;i++)
cout<<L.r[i].key<<" ";
}
int main(){
SqList L;
L.r=new ElemType[MAXSIZE+1];
L.length=0;
Create_Sq(L);
SelectSort(L);
cout<<"简单选择排序:";
show(L);
}

**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。