#include<iostream>
#include<fstream>
#include<vector>
using namespace std;
void order(vector<int>& data);
int main()
{
vector<int> data;
ifstream in("d:\\test.txt");
if(!in)
{
cerr<<"文件不能打开"<<endl;
abort();
}
int temp;
while(!in.eof())
{
in>>temp;
data.push_back(temp);
}
in.close();
order(data);
ofstream out("d:\\out.txt");
if(!out)
{
cerr<<"文件不能打开"<<endl;
abort();
}
for(int i = 0; i < data.size(); i++)
out<<data[i]<<" ";
out.close();
return 0;
}
void order(vector<int>& data) //插入排序
{
int count = data.size();
int i, j;
int temp;
for(i = 1; i < count; i++)
{
temp = data[i];
                for( j = i; j > 0 && data[j-1] > temp; j--)
data[j] = data[j-1];
data[j] = temp;
        }
}