Question #48789

Convert the program to calculate the area and circumference of the circle into function by reference code.

Expert's answer

#include <iostream>

using namespace std;

void CalculateAreaCircumference(float radius, float &area, float &circumReference)

{

circumReference = 2 * 3.14 * radius;

area = 3.14 * radius * radius;

}

int main()

{

float radius, area, circumReference;

cout<<"Enter the radius of the circle ";

cin>>radius;

system("cls");

CalculateAreaCircumference(radius, area, circumReference);

cout<<"Area of the circle : "<<area<<endl<<endl;

cout<<"Circumreference of the circle : "<<circumReference<<endl<<endl;

system("pause");

return 0;

}

using namespace std;

void CalculateAreaCircumference(float radius, float &area, float &circumReference)

{

circumReference = 2 * 3.14 * radius;

area = 3.14 * radius * radius;

}

int main()

{

float radius, area, circumReference;

cout<<"Enter the radius of the circle ";

cin>>radius;

system("cls");

CalculateAreaCircumference(radius, area, circumReference);

cout<<"Area of the circle : "<<area<<endl<<endl;

cout<<"Circumreference of the circle : "<<circumReference<<endl<<endl;

system("pause");

return 0;

}

``

## Comments

## Leave a comment