Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is a C++ question. You need to write _______ parts by yourself to complete

ID: 3729838 • Letter: T

Question

This is a C++ question. You need to write _______ parts by yourself to complete the program.

#include <iostream>

#include <iomanip>

//Call Math library to use Pi value

#define _USE_MATH_DEFINES

#include <math.h>

using namespace std;

//Declare the functions

void getRadius(double _______);

void findArea(double _______, double _______);

void findCircumference(double _______, double _______);

int main() {

double radius; //the radius of the circle

double area; //the area of the circle

double circumference; //the circumference of the circle

//get the value of the radius from the user

getRadius(radius);

//determine the area and circumference

findArea(radius, area);

findCircumference(radius, circumference);

//Output the result

cout << fixed << setprecision(2);

cout << "A circle of radius " << _______ << " has an area of: " << _______ << endl;

cout << "and a circumference of: " << _______ << endl;

system("pause");

return 0;

}

//Define getRadius function to ask user for a input (positive value only)

void getRadius(double &radius) {

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

//Get input from user

___________

//Invalid Input check (Accept the positive value only)

while (___________)

{

cout << "Entered radius is invalid. Please enter a valid radius: ";

//Get input from user again

___________

}

}

//Define findArea function to calculate the area with the entered radius

void findArea(double ___________, double ___________)

{

//caluculate the area of the circle. pi is M_PI.

area = M_PI * ___________;

}

//Define findCircumference function to calculate the circumference with the entered radius

void findCircumference(double ___________, double ___________)

{

//caluculate the circumference of the circle. pi is M_PI.

circumference = ___________ * M_PI * ___________;

}

Explanation / Answer

#include <iostream>

#include <iomanip>

//Call Math library to use Pi value

#define _USE_MATH_DEFINES

#include <math.h>

using namespace std;

//Declare the functions

void getRadius(double &radius);

void findArea(double &radius, double &area);

void findCircumference(double &radius, double &circumference);

int main() {

double radius; //the radius of the circle

double area; //the area of the circle

double circumference; //the circumference of the circle

//get the value of the radius from the user

getRadius(radius);

//determine the area and circumference

findArea(radius, area);

findCircumference(radius, circumference);

//Output the result

cout << fixed << setprecision(2);

cout << "A circle of radius " << radius << " has an area of: " << area << endl;

cout << "and a circumference of: " << circumference << endl;

system("pause");

return 0;

}

//Define getRadius function to ask user for a input (positive value only)

void getRadius(double &radius) {

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

//Get input from user

cin>>radius;

//Invalid Input check (Accept the positive value only)

while (radius<=0)

{

cout << "Entered radius is invalid. Please enter a valid radius: ";

//Get input from user again

cin>>radius;

}

}

//Define findArea function to calculate the area with the entered radius

void findArea(double &radius, double &area)

{

//caluculate the area of the circle. pi is M_PI.

area = M_PI * radius *radius;

}

//Define findCircumference function to calculate the circumference with the entered radius

void findCircumference(double &radius , double &circumference)

{

//caluculate the circumference of the circle. pi is M_PI.

circumference = 2 * M_PI * radius;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote