Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void funkcja(int& liczba) // funkcja pobiera zmienną przez tzw. referencję - będzie ona pracowała na oryginalnej zmiennej
- {
- cout << liczba << endl; // 2. 10
- ++liczba;
- cout << liczba << endl; // 3. 11
- liczba *= 3;
- cout << liczba << endl; // 4. 33
- --liczba;
- cout << liczba << endl; // 5. 32
- }
- int main()
- {
- int liczba = 10;
- cout << liczba << endl; // 1. 10
- funkcja(liczba);
- cout << liczba << endl; // 6. 32
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement