#include
#include
#include
using namespace std;
int main()
{
int n = 10000;
int[10000] content;
fstream outfile;
srand(GetTickCount());
for(i=0;i
//由于rand函数生成的数范围是0~0x7fff,所以生成的随机数先除0x7fff,
//再乘10000,得到的范围就是0~10000
content[i] = (int)((double)rand() / (double)0x7fff * (double)10000);
i--;
}
outfile.open("a.txt", fstream::out);//将数据写入文件
outfile << content<< '\t';
outfile.close();
sort() //排序
outfile.open("a.txt", fstream::out);//将数据写入文件
outfile << content<< '\t';
outfile.close();
return 0;
}