//#include "stdafx.h"//vc++6.0加上这一行.
#include "
stdio.h"
#include "time.h"
#include "
stdlib.h"
int main(void){
int nDec[100],i,j,k;
srand((unsigned)time(NULL));
for(i=0;i<100;nDec[i++]=rand());
for(i=0;i<100;i++){
for(k=i,j=k+1;j<100;j++)
if(nDec[k]>nDec[j]) k=j;
if(i!=k){
j=nDec[i];
nDec[i]=nDec[k];
nDec[k]=j;
}
printf("%d ",nDec[i]);
}
printf("\n");
return 0;
}
本回答被提问者和网友采纳