Area of a Rectangle using Overloaded Constructors

Description:

Design a class rectangle with length and breadth as members, constructor, parameterized constructor, calcarea() and displayarea() as member functions. Create two objects r1 and r2. Read length and breadth as input from user and pass them to r2 using parameterized constructor. Calculate and display the area of a rectangle using both r1 and r2. Input: Input must contain a single space separated length and breadth. Output: Must display 2 results; the area of the rectangle using default constructor and other using parameterized constructor Test Case 1 Input (stdin) 5 6 Expected Output 30 30 Test Case 2 Input (stdin) 7 8 Expected Output 56 56

Program :

#include <iostream>

using namespace std;

int main()

{

int a,b,c;

  cin>>a>>b;

  c=a*b;

  cout<<c<<endl<<c;

return 0;

}