Question: Task: Write the full program that has the following main function. Your program should ask the user for Length and Width of a rectangle, and
Task: Write the full program that has the following main function. Your program should ask the user for Length and Width of a rectangle, and also for his choice: 1 or 2. If the user enters 1, then the program calculates the area of the rectangle. If the user enters 2, then the program calculates the perimeter of the rectangle. In the end, the program should display the area and the perimeter to the user.
(Hint: area=width*length & perimeter=2*( width+length))
int main()
{
int choice;
double L,W,Area, Perim;
readDimentions(L,W);
readChoice(choice);
if (choice==1)
Area=findArea(L,W);
else if (choice==2)
Perim=findPerim(L,W);
else
{
cout<<" You entered a wrong choice"< return 0; } printResults(Area,Perim,choice); return 0; } Functions:
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
