#include<iostream.h>

#include<conio.h>

#include<math.h>

void main()

{

clrscr(); //to clear the screen

float a,b,c,s,r,area;

int ch;

cout<<“***Menu***n1.Area of circlen2.Area of Rectangle”;

cout<<“n3.Area of trianglenEnter your choice:”;

cin>>ch;

switch(ch)

{

case 1:

{

cout<<“nEnter radius of the circle:”;

cin>>r;

area=3.14*r*r;

break;

}

case 2:

{

cout<<“nEnter length and breadth:”;

cin>>a>>b;

area=a*b;

break;

}

case 3:

{

cout<<“nEnter three sides of the triangle:”;

cin>>a>>b>>c;

s=(a+b+c)/2;

area=sqrt(s*(s-a)*(s-b)*(s-c));

break;

}

default: cout<<“nWrong choice…!!!”;

break;

}

cout<<“Area=”<<area;

getch(); //to stop the screen

}

Thanks . Good C Program and it is also very basic

Good One 🙂 !!!!!!!!!!!!!!!!!!!!!!!

That was great.

Can you please tell me what I did wrong here??

//Give the Area of a Square or a Triangle.

#include // tells the compiler to include this file

#include // tells the compiler to include this file

#include// tells the compiler to include this file

#include// tells the compiler to include this file

using namespace std; //use the standart namespace

float findSArea(float s); // function that calculates Square area

float findTArea(float b, float h); // function that calculates Triangle area

int main() // start of main function

{

float side, base, height; //input: data for calc

float square, triangle;

char letter;

char S,T;

float num;

cout<<"Please enter S for Square or T for Triangle (in capital letters): "<>letter;

// decide what to do

if ((letter==S) || (letter==T)) {

if (letter==S) {

cout<>side;

num=findSArea(s); // function call to calculate the Square area

cout<>num;

}

if (letter==T) {

cout<>base>>height;

num=findTArea(b,h); // function call to calculate the Triangle area

cout<>num;

}

}

else

{

cout<< "invalid character! ";

}

system ("pause");

return 0; }

// Compute the area of a Square with side s

//Pre: s is defined

//Post: returns area

float findSArea(float s)

{return (pow (s,2)); }

// Compute the area of a triangle with base b & height h

//Pre: b & H are defined

//Post: returns area

float findTArea(float b,h)

{return (0.5 * b * h); }

Write a c++ program that will:

• Provide 2 options to the user as below:

Enter 1 to calculate the area of Rectangle

Enter 2 to calculate the area of a Trapezoid

• If the user enters 1, then the program should ask the user to enter the width and length of the rectangle and then show the result after calculation. Formula for calculating Area of rectangle is

Area = width x Length.

• If the user enters 2, then the program should ask the user to enter the base1, base2, and height of the trapezoid and then show the result after calculation. Formula for calculating Area of trapezoid is

Area =

• You must implement two different functions for calculating areas of rectangle and trapezoid.

• After taking the choice from the user in form of 1 or 2, the relevant function should be called.

• After showing the output to the user, you need to ask the user if he/she wants to do another calculation. If the user presses y or Y, then the program should ask the user again to enter the choice of shape otherwise the program should be terminated.

Screenshot of the program execution is given below for both shapes:

Sample output:

please bro tell me the solution of this problem

i dont wanna code but instructions please

Please include flow charts too

a c++ program to calculate area of the circle , square and rectangle using runtime polymorphism anyone plz reply for it thanks in advance

#include

using namespace std;

void main()

{int a,b,c,d,e;

for(a=1;a<=4;a++)

{switch(a)

{case 1:

cout<<a<<endl;

case 2:

for(b=2;b<=3;b++)

{cout<<b<<"\t";}

for(e=1;e<=4;e++)

{cout<<"*";}

cout<<endl;break;

case 3:

for(c=4;c<=6;c++)

{cout<<c<<"\t";}

cout<<endl;break;

case 4:

for(d=7;d<=10;d++)

{cout<<d<<"\t";}

cout<<endl;break;

default:

cout<<"lol"<<endl;

}

}} (why case 2 is printing 2 times)

Create a program that allows the user to select a shape he/she wants to compute the area. The program should accept either a lowercase or uppercase.

Note: Area should be presented in two decimal places.

Sample Output:

Area of Shapes

[S] – Square

[C] – Circle

[T] – Triangle

[R] – Rectangle

Enter your choice: s

Enter side:5

Area is: 25

How To Create This?