Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <iostream>
  2. #include "rectangle.h"
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     Rectangle a, b(4.0, 5.0), c(67.0, 888.0);
  8.     cout << fixed;
  9.     cout << setprecision(1);
  10.     // output Rectangle a
  11.     cout << "a: length = " << a.getLength() << "; width = "
  12.         << a.getWidth() << "; perimeter = " << a.calculatePerimeter()
  13.         << "; area = " << a.calculateArea() << '\n';
  14.     // output Rectangle b
  15.     cout << "b: length = " << b.getLength() << "; width = "
  16.         << b.getWidth() << "; perimeter = " << b.calculatePerimeter()
  17.         << "; area = " << b.calculateArea() << '\n';
  18.     // output Rectangle c; bad values attempted
  19.     cout << "c: length = " << c.getLength() << "; width = "
  20.         << c.getWidth() << "; perimeter = " << c.calculatePerimeter()
  21.         << "; area = " << c.calculateArea() << endl;
  22. } // end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement