Advertisement
Guest User

Untitled

a guest
Oct 25th, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. //Michał Kurpiński
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. void zeruj1(int a,int b)
  6. {
  7.  
  8. cout<<"przed wyzerowaniem a="<<a<<" b="<<b;
  9. a=0;
  10. b=0;
  11. cout<<" po wyzerowaniu a="<<a<<",b="<<b;
  12. }
  13. void zeruj2(int &a,int &b)
  14. {
  15. cout<<"przed wyzerowaniem a="<<a<<" b="<<b;
  16. a=0;
  17. b=0;
  18. cout<<" po wyzerowaniu a="<<a<<",b="<<b;
  19. }
  20. int main()
  21. {
  22. int x=5,y=3;
  23. cout<<"w jaki sposob wyzerowac wartosci?"<<endl<<"1. przekazywanie przez wartosc"<<endl<<"2. przekazywanie przez referencje";
  24. int liczba;
  25. cout<<endl;
  26. cin>>liczba;
  27. switch(liczba)
  28. {
  29. case 1:
  30. zeruj1(x,y);
  31. break;
  32. case 2:
  33. zeruj2(x,y);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement