Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Can someone fix this code please, I keep getting errors and it is not building. This is the Assignment: Create a program that calculates

C++

Can someone fix this code please, I keep getting errors and it is not building.

This is the Assignment: Create a program that calculates the hypotenuse of a triangle, the area of a trapezoid, and the volume of a rectangle. The user must input the variables in the formulas.

Code:

#include

#include

using namespace std;

int main()

{

//----- Hypotenuse of a triangle -----

int perp,base,product;

float hypotenuse;

cout<<" - Hyptenuse of a triangle - ";

cout<<" Enter the length of the base : ";

cin>>base;

cout<<" Enter the length of perpendicular : ";

cin>>perp;

product= pow(perp,2) + pow(base,2);

hypotenuse = pow(product, 0.5) ;

cout<<" Hypotenuse : "<

//---- Area Of Trapezoid -----

int Area,a,b,h;

cout<<" Length of one side : ";

cin>>a;

cout<<" Length of second side : ";

cin>>b;

cout<<" Height of trapezoid : ";

cin>>h;

Area = ((a+b)/2)*h;

cout<<" Area of trapezoid : "<

//------ Area of Rectangle -----

int l,b,h,V;

cout<<" Enter height of solid rectangle : ";

cin>>h;

cout<<" Enter length of solid rechtangle : ";

cin>>l;

cout<<" Enter width of solid rectangle : ";

cin>>b;

V= h * l * b;

cout<<" Volume of the solid rectangle "<

return 0;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Records And Database Management

Authors: Jeffrey R Stewart Ed D, Judith S Greene, Judith A Hickey

4th Edition

0070614741, 9780070614741

More Books

Students also viewed these Databases questions

Question

Choosing Your Topic Researching the Topic

Answered: 1 week ago

Question

The Power of Public Speaking Clarifying the

Answered: 1 week ago