nvnnaidenov

Zad55

Oct 15th, 2021
1,008
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <iomanip>
  3.  
  4. using namespace std;
  5.  
  6. void swapi(double& x, double& y)
  7. {
  8.     double temp;
  9.     temp = x;
  10.     x = y;
  11.     y = temp;
  12. }
  13.  
  14. int main()
  15. {
  16.     double a;
  17.     double b;
  18.     double c;
  19.     double d;
  20.  
  21.     cout << "a = ";
  22.     cin >> a;
  23.     cout << "b = ";
  24.     cin >> b;
  25.     cout << "c = ";
  26.     cin >> c;
  27.     cout << "d = ";
  28.     cin >> d;
  29.  
  30.     //cout << setprecision(2) << setiosflags(ios::fixed);
  31.     cout << setw(3) << a << setw(3) << b << setw(3) << c << setw(3) << d << endl;
  32.  
  33.     swapi(a, b);
  34.     swapi(c, d);
  35.  
  36.     cout << setw(3) << a << setw(3) << b << setw(3) << c << setw(3) << d << endl;
  37.  
  38.     return 0;
  39. }
RAW Paste Data