This C++ Program which computes area of circle. The program takes radius of the circle as an input, calculates the area of the circle and outputs it on the screen.
Here is source code of the C++ program which computes area of circle. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.
* C++ Program to Compute the Area of Circle
float radius, area;
std::cout << "Enter the radius of circle : ";
std::cin >> radius;
area = 3.14 * radius * radius;
std::cout << "Area of circle with radius "
<< radius << " is " << area;
$ g++ main.cpp $ ./a.out Enter the radius of circle : 5 Area of circle with radius 5 is 78.5
Sanfoundry Global Education & Learning Series – 1000 C++ Programs.
If you wish to look at all C++ Programming examples, go to C++ Programs.