Advertisement
dzieciol

zajecia 2

Oct 14th, 2016
388
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class kursor
  6.     {
  7.         int x,y;
  8.         public:
  9.         void ustal()
  10.         {
  11.             int a,b;
  12.             cout<<"podaj wspolzedne x"<<endl;
  13.             cin>>a;
  14.             cout<<"podaj wspolzedne y"<<endl;
  15.             cin>>b;
  16.             if((a<80)&& (b<25))
  17.             {
  18.                 this->x=a;
  19.                 this->y=b;
  20.             }
  21.             else
  22.             {
  23.                 cout<<"podales bledne wspolzedne"<<endl;
  24.                 this->x=0;
  25.                 this->y=0;
  26.             }
  27.  
  28.  
  29.         }
  30.        
  31.        
  32.         void pokaz()
  33.         {
  34.             cout<<"x="<<x<<endl;
  35.             cout<<"y="<<y<<endl;
  36.         }
  37.     };
  38.  
  39. int main()
  40. {
  41.    // cout << "Hello world!" << endl;
  42.    kursor a,b,c,d;
  43.     a.ustal();
  44.     b.ustal();
  45.     c.ustal();
  46.     d.ustal();
  47.     a.pokaz();
  48.    
  49.  
  50.  
  51.  
  52.     return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement