brsjak

stip-3

Aug 29th, 2016
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.37 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. using namespace std;
  5. class primer{
  6. int i;
  7. public:
  8.     primer(int n){
  9.         i=n;
  10.     }
  11.     void postavi_i(int n){
  12.         i=n;
  13.     }
  14.     int zemi_i(){
  15.         return i;
  16.     }
  17. };
  18. void soberi(primer *o){
  19.     o->postavi_i(o->zemi_i()+o->zemi_i());
  20.     cout<<o->zemi_i()<<" ";
  21. }
  22. int main(){
  23.     primer a(5);
  24.     soberi(&a);
  25.     cout<<a.zemi_i()<<endl;
  26.     return 0;
  27. }
Add Comment
Please, Sign In to add comment