Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is a C++ question. You need to write _______ parts by yourself to complete the program. #include #include //Call Math library to use Pi

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

#include

#include

//Call Math library to use Pi value

#define _USE_MATH_DEFINES

#include

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 * ___________;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions