Advertisement
MeehoweCK

Untitled

May 1st, 2023
802
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int funkcja(int& a)         // pobranie argumentu poprzez referencję (funkcja będzie pracować na podanej zmiennej)
  6. {
  7.     cout << a << endl;                  // 2. 10
  8.     ++a;
  9.     cout << a << endl;                  // 3. 11
  10.     return a;
  11. }
  12.  
  13. int main()
  14. {
  15.     int liczba = 10;
  16.     cout << liczba << endl;             // 1. 10
  17.     cout << funkcja(liczba) << endl;    // 4. 11
  18.     cout << liczba << endl;             // 5. 11
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement