Srxon05

cmt XnaY zadatak

Oct 25th, 2017
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4.  
  5. class XnaY{
  6.  
  7.     private: double x, y, XnaY1=1;
  8.     public: void setX(double x1){
  9.         x=x1;
  10.     }
  11.     public: void setY(double y1){
  12.         y=y1;
  13.     }
  14.     public: void setX_Y(double x1,double y1){
  15.         x=x1;
  16.         y=y1;
  17.     }
  18.     public: double getX(){
  19.         return x;
  20.     }
  21.     public: double getY(){
  22.         return y;
  23.     }
  24.     public: double getXnaY(){
  25.         return pow(x,y);
  26.     }
  27.     public: XnaY(){
  28.         x=1;
  29.         y=1;
  30.     }
  31. };
  32.  
  33. int main()
  34. {
  35.     XnaY s;
  36.     double a, b, anab;
  37.     cout<<"Unesi x= ";
  38.     cin>>a;
  39.     cout<<"Unesi y= ";
  40.     cin>>b;
  41.     s.setX(a);
  42.     s.setY(b);
  43.     cout<<"x= ";
  44.     cout<<s.getX()<<endl;
  45.     cout<<"y= ";
  46.     cout<<s.getY()<<endl;
  47.     anab=s.getXnaY();
  48.     cout<<"X na Y= ";
  49.     cout<<anab;
  50.  
  51.  
  52.  
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment