**Introduction**

This post will Teach you to create a program in C++ to Calculate the area of different shapes.The first one will calculate the area of Square. The next will calculate area of Circle. The next one will calculate area of Rectangle. And the last one will calculate the area of Equilateral Triangle. So you can create more program for more different shapes. Go enjoy the program. Lets begin…………………..

**Program to calculate area of square**

```
#include<iostream.h>
#include<conio.h>
void main()
{
//clear the screen.
clrscr();
//declare variable type int
int a,area;
//Input the side and save it in 'a'
cout<<"Enter the side of square"<<endl;
cin>>a;
//calculate area and save it in 'area'
area=a*a;
//show the output 'area'
cout<<"Area of square is "<<area;
//get character
getch();
}
```

**Output**

Enter the side of square

5

Area of square is 25

**Program to calculate area of circle**

```
#include<iostream.h>
#include<conio.h>
void main()
{
//clear the screen.
clrscr();
//declare variable type float
float a,area;
//Input the radius and save it in 'a'
cout<<"Enter the radius of circle"<<endl;
cin>>a;
//calculate area and save it in 'area'
area=3.14*a*a;
//show the output 'area'
cout<<"Area of circle is "<<area;
//get character
getch();
}
```

**Output**

Enter the radius of circle

2

Area of circle is 12.56

**Program to calculate Area of Rectangle**

```
#include<iostream.h>
#include<conio.h>
void main()
{
//clear the screen.
clrscr();
//declare variable type float
float l,b,area;
//Input the length and breadth and save it in 'l' and 'b' respectively
cout<<"Enter the length of rectangle"<<endl;
cin>>l;
cout<<"Enter the breadth of rectangle"<<endl;
cin>>b;
//calculate area and save it in 'area'
area=l*b;
//show the output 'area'
cout<<"Area of rectangle is "<<area;
//get character
getch();
}
```

**Output**

Enter the length of rectangle

2

Enter the breadth of rectangle

4

Area of rectangle is 8

**Program to calculate area of Equilateral Triangle**

```
#include<iostream.h>
#include<conio.h>
void main()
{
//clear the screen.
clrscr();
//declare variable type float
float a,b,area;
//Input the side and save it in 'a'
cout<<"Enter the side of Equilateral Triangle"<<endl;
cin>>a;
cout<<"Enter the height of Equilateral Triangle"<<endl;
cin>>b;
//calculate area and save it in 'area'
area=(a*b)/2;
//show the output 'area'
cout<<"Area of Equilateral Triangle is "<<area;
//get character
getch();
}
```

**Output**

Enter the side of Equilateral Triangle

2

Enter the height of Equilateral Triangle

5

Area of Equilateral Triangle is 5

**How does it work**

- You enter the necessary inputs for calculation in and is saved in variables.
- The Area is calculated according to area formula and is saved in ‘area’.
- Variable ‘area’ is shown by cout.

**Extending it**

The program can be extended by using more different shapes of geometry. You can take the necessary inputs and calculate the area of the given geometry.

**Explanation.**

- Include ‘iostream.h’ and ‘conio.h’ files.
- Add void main.
- Start program by first clearing the screen.
- Declare the variables as float (name the as you want.)
- Add cout and cin of variables of necessary inputs.(as shown in program)
- Calculate the area of the variables and save them in ‘area’ variable.
- Cout the ‘area’ variable.

**At the end**

You learnt creating the c++ program of Area of geometrical shapes. So now enjoy the program.

Please comment on the post and share it.

And like it if you liked.