Guest User

Untitled

a guest
Jul 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. // Rectangle Project.cpp : class constructor
  2. //
  3.  
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. class CRectangle {
  8. int width, height;
  9. public:
  10. CRectangle (int, int);
  11. int area() {
  12. return (width*height);
  13. }
  14. } rectc(7,8);
  15.  
  16. CRectangle::CRectangle (int a, int b) {
  17. width = a;
  18. height = b;
  19. }
  20.  
  21. int main() {
  22. CRectangle rect(3, 4);
  23. CRectangle rectb(5, 6);
  24. cout << "rect area: " << rect.area() << endl;
  25. cout << "rectb area: " << rectb.area() << endl;
  26. cout << "rectc area: " << rectc.area() << endl;
  27. return 0;
  28. }
Add Comment
Please, Sign In to add comment