Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- class XnaY{
- private: double x, y, XnaY1=1;
- public: void setX(double x1){
- x=x1;
- }
- public: void setY(double y1){
- y=y1;
- }
- public: void setX_Y(double x1,double y1){
- x=x1;
- y=y1;
- }
- public: double getX(){
- return x;
- }
- public: double getY(){
- return y;
- }
- public: double getXnaY(){
- return pow(x,y);
- }
- public: XnaY(){
- x=1;
- y=1;
- }
- };
- int main()
- {
- XnaY s;
- double a, b, anab;
- cout<<"Unesi x= ";
- cin>>a;
- cout<<"Unesi y= ";
- cin>>b;
- s.setX(a);
- s.setY(b);
- cout<<"x= ";
- cout<<s.getX()<<endl;
- cout<<"y= ";
- cout<<s.getY()<<endl;
- anab=s.getXnaY();
- cout<<"X na Y= ";
- cout<<anab;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment