Answer to Question #266514 in C++ for Wendy

Question #266514

Create C++ full program that calculates area of a rectangle and triangle


1
Expert's answer
2021-11-17T17:39:37-0500
#include <iostream>


using namespace std;


int main()
{
    int length,width, height,base,area;
    cout << "Enter the width" << endl;
    cin>>width;
    cout << "Enter the length" << endl;
    cin>>length;
    area=length*width;
    cout<<"area of a rectagle is: "<<area<<endl;
    cout << "Enter the height" << endl;
    cin>>height;
    cout << "Enter the base" << endl;
    cin>>base;
    area=0.5*base*height;
    cout<<"area of a triangle is: "<<area<<endl;
    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS