Advertisement
Savelyev_Vyacheslav

5 lab c++

Oct 23rd, 2020
200
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. //  ios_base::sync_with_stdio(false);
  9. //  cin.tie(0);
  10.  
  11.   ifstream in("input.txt");
  12.  
  13.   while (in.peek() != EOF) {
  14.     string a;
  15.     string b;
  16.    
  17.     in >> a >> b;
  18.  
  19.     if (b.empty()) {
  20.       cout << a << ' ';
  21.     } else {
  22.       cout << b << ' ' << a << ' ';
  23.     }
  24.   }
  25.  
  26.   in.close();
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement