nvnnaidenov

Zad56

Oct 15th, 2021
1,057
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&, double&);
  7.  
  8. int main()
  9. {
  10.     double a;
  11.     double b;
  12.     double c;
  13.     double d;
  14.  
  15.     cout << "a = ";
  16.     cin >> a;
  17.     cout << "b = ";
  18.     cin >> b;
  19.     cout << "c = ";
  20.     cin >> c;
  21.     cout << "d = ";
  22.     cin >> d;
  23.  
  24.     cout << setw(3) << a << setw(3) << b << setw(3) << c << setw(3) << d << endl;
  25.  
  26.     Swapi(a, b);
  27.     Swapi(c, d);
  28.  
  29.     cout << setw(3) << a << setw(3) << b << setw(3) << c << setw(3) << d << endl;
  30.  
  31.     return 0;
  32. }
  33.  
  34. void Swapi(double& x, double& y)
  35. {
  36.     double temp;
  37.     temp = x;
  38.     x = y;
  39.     y = temp;
  40. }
RAW Paste Data