nvnnaidenov

Zad54

Oct 15th, 2021
766
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 << setw(3) << a << setw(3) << b << setw(3) << c << setw(3) << d << endl;
  31.  
  32.     swapi(&a, &b);
  33.     swapi(&c, &d);
  34.  
  35.     cout << setw(3) << a << setw(3) << b << setw(3) << c << setw(3) << d << endl;
  36.  
  37.     return 0;
  38. }
RAW Paste Data