返回列表 發帖
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. ifstream ifs;
  4. ofstream ofs;
  5. vector<int>v;
  6. int main()
  7. {
  8.     ifs.open("read.txt");
  9.     ofs.open("write.txt");
  10.     int n;
  11.     for(int i=0;i<4;i++)
  12.     {
  13.         cin>>n;
  14.         v.push_back(n);
  15.     }
  16.     while(ifs>>n)
  17.         v.push_back(n);
  18.     sort(begin(v),end(v));
  19.     for(int i:v)
  20.     {
  21.         cout<<i<<'\n';
  22.         ofs<<i<<'\n';
  23.     }
  24.     return 0;
  25. }
複製代碼

TOP

返回列表