Advertisement
filomancio

Es Informatica per 09/03/2012

Mar 7th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include "iostream"
  2.  
  3. using namespace std;
  4.  
  5. int a=7,b=5,c=10;
  6.  
  7. void f1(int& x, int& y, int& z)
  8. {
  9.     x=(x*x)+1;
  10.     y=x;
  11.     z=2;
  12.     cout<<a<<' '<<b<<' '<<c<<endl;
  13.     cout<<x<<' '<<y<<' '<<z<<endl;
  14. }
  15.  
  16. void f2(int& x, int y, int z)
  17. {
  18.     x=x*y;
  19.     y=3;
  20.     z=x*y;
  21.     cout<<a<<' '<<b<<' '<<c<<endl;
  22.     cout<<x<<' '<<y<<' '<<z<<endl;
  23. }
  24.  
  25. void f3(int* x, int y, int& z)
  26. {
  27.     *x=10;
  28.     y=2*(*x);
  29.     z=6;
  30.     cout<<a<<' '<<b<<' '<<c<<endl;
  31.     cout<<*x<<' '<<y<<' '<<z<<endl;
  32. }
  33.  
  34. int main()
  35. {
  36.     f1(a,b,c);
  37.     cout<<a<<' '<<b<<' '<<c<<endl;
  38.     f2(a,b,c);
  39.     cout<<a<<' '<<b<<' '<<c<<endl;
  40.     f3(&a,b,c);
  41.     cout<<a<<' '<<b<<' '<<c<<endl;
  42.     system("PAUSE");
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement