Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <cstdlib>
  2. #include <ctime>
  3. #include <iostream>
  4.  
  5. using namespace std;
  6. class Reca{
  7.     int x,y;
  8.     public:
  9.     void set_value(int,int);
  10.     int area(void);
  11.    
  12. };
  13.  
  14. void Reca::set_value(int a,int b)
  15. {x=a;
  16. y=b;
  17. }
  18.  
  19. int Reca::area()
  20. { return(x*y);
  21. }
  22. int main()
  23. { int x1,y2;
  24. cout<<"Please enter x and y value"<<endl;
  25. cin>>x1>>y2;
  26. Reca rec1;
  27. rec1.set_value(x1,y2);
  28. cout<<"your area is ---> "<<rec1.area()<<endl;
  29.  return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement