Area Calculator: Write a program to calculate the area of some simple geometric shapes. The shapes required to be included are rectangles, circles, and right triangles. Because we have not covered conditional code yet, we will calculate all the shapes in order. Your program must: Ask the user for the values necessary to compute the area of each shape o Rectangle o Circle You must use an accurate value of pi (3.14159265359) o Right Triangle o The input must accept non-whole numbers Display the results to the user You do not need to attempt to make the program correct for improper input (e.g. negative numbers or non-numbers)

## Expert Answer

**PROGRAM CODE:**#include <iostream>

using namespace std;

#define pi 3.14159265359

void rectangleArea(double l, double w)

{

cout<<“nArea of the rectangle is “<<l*w<<endl;

}

void circleArea(double r)

{

cout<<“nArea of the circle is “<<(pi*r*r)<<endl;

}

void rightTriangleArea(double h, double b)

{

cout<<“nArea of the right triangle is “<<h*b/2<<endl;

}

int main() {

double length, width, radius;

cout<<“Calculating area for rectangle…”<<endl;

cout<<“Enter length: “;

cin>>length;

cout<<“nEnter width: “;

cin>>width;

rectangleArea(length, width);

cout<<“nCalculating area for circle…”<<endl;

cout<<“Enter radius: “;

cin>>radius;

circleArea(radius);

cout<<“nCalculating area for right triangle…”<<endl;

cout<<“Enter base: “;

cin>>width;

cout<<“nEnter height: “;

cin>>length;

rightTriangleArea(length, width);

return 0;

}

**OUTPUT:**

Calculating area for rectangle... Enter length: 10 Enter width: 20 Area of the rectangle is 200 Calculating area for circle... Enter radius: 5 Area of the circle is 78.5398 Calculating area for right triangle... Enter base: 12 Enter height: 20 Area of the right triangle is 120