#include
#include
#include
#include
#include
#include
using namespace std;
void sort(int *data,int *fid,int *iid,int count,int dir)
{
int *rank;
int i,j,k,l,m,n,temp;
rank=new int[count];
for(i=0;i
for(k=j+1;k
if(rank[j]
temp=rank[j];rank[j]=rank[k];rank[k]=temp;
}
}
}
for(m=0;m
for(n=0;n
if(data[n]==rank[m]){iid[m]=fid[n];}
}
}
if(dir==1)
{
system("cls");
cout<<"名次 "<<"成绩 "<<"学号 "<
cout<
}
if(dir==0)
{
system("cls");
cout<<"名次 "<<"成绩 "<<"学号 "<
{
cout<
}
}
int main(void)
{
int i,count,dir;
int *data,*fid, *iid;
cout<<"请输入学生数目:"<
data=new int[count];
fid=new int[count];
iid=new int[count];
for(i=1;i<=count;i++)
{
cout<<"请输入第"< cin>>fid[i-1];//iid[i-1]=fid[i-1];
cout<<"请输入第"< cin>>data[i-1];
}
system("cls");
cout<<"请选择成绩的排序方式:"<
sort(data,fid,iid,count,dir);
return 0;
}