Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class CRectangle {
  5. int x, y;
  6. public:
  7. void set_values (int,int);
  8. int area () {return (x*y);}
  9. };
  10.  
  11. void CRectangle::set_values (int a, int b) {
  12. x = a;
  13. y = b;
  14. }
  15.  
  16. int main () {
  17. CRectangle rect;
  18. rect.set_values (3,4);
  19. cout << "area: " << rect.area();
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement