返回列表 發帖
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. ifstream ifs;
  4. ofstream ofs;
  5. int n;
  6. vector<int>V;
  7. int main()
  8. {
  9.     ifs.open("read.txt");
  10.     ofs.open("write.txt");
  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<<endl;
  22.         ofs<<i<<'\n';
  23.     }
  24.     return 0;
  25. }
複製代碼

TOP

返回列表