0

Okay, i have written a code to figure out the area of all different shapes but i can't get it past hte pasrt where the client chooses what they want to find the area of.

this is my code:

```
#include <iostream>
#include <cmath>
using namespace std;
int getChoice();
int circle();
int rectangle();
int trapazoid();
int triangle();
int parallelogram();
int main()
{
int choice;
do{
choice = getChoice();
if ( choice == 1 ) circle();
else if ( choice == 2 ) rectangle();
if ( choice > 6 || choice < 1 )
cout << "\nPlease enter a valid number.\n"<<endl;
else if ( choice == 3 ) trapazoid();
if ( choice == 4 ) triangle();
else if (choice == 5) parallelogram();
} while ( choice != 6);
}
int getChoice()
{
int x;
cout << " ||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~||" << endl;
cout << " || Area Of 2-D Shapes ||" << endl;
cout << " ||---------------------------------------------||" << endl;
cout << " || Press 1 to find the area of a circle ||" << endl;
cout << " || Press 2 to find the area of a rectangle ||" << endl;
cout << " || Press 3 to find the area of a trapazoid ||" << endl;
cout << " || Press 4 to find the area of a triangle ||" << endl;
cout << " || Press 5 to find the area of a parallelogram ||" << endl;
cout << " || Press 6 to quit ||" << endl;
cout << " || ||" << endl;
cout << " ||~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~||\n" << endl;
cout << "\nPlease enter number for your choice: ";
cin >> x;
}
int circle()
{
double answer1;
double r;
cout << "\nEnter Radious of the circle = ";
cin >> r;
answer1 = 3.14159*r*r;
cout << "\nArea = " <<answer1;
}
int rectangle()
{
double answer2;
double w;
double h;
cout << "\nEnter the width of the rectangle = ";
cin >> w;
cout << "\nEnter the height of the rectangle = ";
cin >> h;
answer2 = w*h;
cout << "\nArea = " << answer2;
}
int trapazoid()
{
double answer3;
double h;
double b1;
double b2;
cout << "\nEnter the hight of the trapezoid: ";
cin >> h;
cout << "\nEnter the bottom base of the Trapezoid: ";
cin >> b1;
cout << "\nEnter the top base of the Trapezoid: ";
cin >> b2;
answer3 = 0.5 * h * (b1 + b2);
cout << "\nArea = " << answer3;
}
int triangle()
{
double answer4;
double h;
double b;
cout << "\nEnter the base of the triangle: ";
cin >> b;
cout << "\nEnter the height of the triangle: ";
cin >> h;
answer4 = 0.5 * b * h;
cout << "\nArea = " << answer4;
}
int parallelogram()
{
double answer5;
double b;
double h;
cout << "\nEnter the base of the Parallelogram = ";
cin >> b;
cout << "\nEnter the height of the Parallelogram = ";
cin >> h;
answer5 = b*h;
cout << "\nArea = " << answer5;
}
```