Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4. using namespace std;
  5.  
  6. void by_value(int a){
  7. a = 77;
  8. }
  9.  
  10. void by_address(int *c){
  11. *c=99;
  12. }
  13.  
  14. void by_reference(int &b){
  15. b=88;
  16. }
  17.  
  18. struct clovek{
  19. int age=0;
  20. string name="/";
  21. };
  22.  
  23.  
  24. int main(){
  25. ofstream file1;
  26. file1.open("234.txt");
  27.  
  28. file1 << "Seos";
  29.  
  30. int st=5;
  31. int* ptr=&st;
  32. cout << ptr << endl;
  33.  
  34. int miran=5;
  35. int joze=10;
  36. int franc=15;
  37.  
  38. by_value(miran);
  39. by_address(&joze);
  40. by_reference(franc);
  41.  
  42. cout << "VALUE: " << miran << endl;
  43. cout << "ADDRESS: " << joze << endl;
  44. cout << "REFERENCE: " << franc << endl;
  45.  
  46. clovek cl1;
  47. cl1.age=10;
  48.  
  49. cout << cl1.age << endl;
  50. cout << "ime: " << endl;
  51.  
  52. getline(cin,cl1.name);
  53.  
  54. cout << "Vase ime je "<< cl1.name << endl;
  55.  
  56. return 0;
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement