# C++ Circle Area or Circumference Program

By | November 3, 2019

Task: Write a C++ Program To Calculate Circle Area or Circumference according to the User choice.

Write a C++ Program To Calculate Circle Area or Circumference according to the User choice.

## The Source Code of C++ Circle Program

```// Write a program that uses two user defined functions
// for calculating area and circumference of a circle.
// to enter a choice 1 or 2.
//If the user enters 1, it will display area
// if the user eneters 2 then circumference
//of the circle will be the output

#include<iostream>
using namespace std;
void area(float);
void circumference(float);
int main()
{
int choice;
cout<<"Enter Your Choice 1 for Area and 2 for Circumference:";
cin>>choice;

if(choice==1)
else if(choice==2)
else
cout<<"Wrong choice!";

return 0;
}

void area(float r)
{
cout<<"Area of Circle="<<(3.1415 * r* r);
}
void circumference(float r)
{
cout<<"Circumferenceb of Circle="<<(2.0 * 3.1415 * r);
}
```

## Output of the C++ Circle Program Calculations

Enter Your Choice 1 for Area and 2 for Circumference:1
Area of Circle=19.6344
——————————–
Process exited after 18.92 seconds with return value 0
Press any key to continue . . .

Enter Your Choice 1 for Area and 2 for Circumference:2
Circumferenceb of Circle=15.7075
——————————–
Process exited after 21.03 seconds with return value 0
Press any key to continue . . .

Enter Your Choice 1 for Area and 2 for Circumference:1
Area of Circle=86.9178
——————————–
Process exited after 11.3 seconds with return value 0
Press any key to continue . . .

Enter Your Choice 1 for Area and 2 for Circumference:2
Circumferenceb of Circle=67.0396
——————————–
Process exited after 17.52 seconds with return value 0
Press any key to continue . . .