Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Copy the following code and run it. You should break it into the following 3 functions getValidInput - which asks the user to enter the

Copy the following code and run it. You should break it into the following 3 functions getValidInput - which asks the user to enter the radius and then make sure that it is valid before returning it circleCalculations - which uses the raius passed in to calculate both the area and the circumference. The area is returned printResults - sets the fixed and precision and prints out the output

#include  #include  using namespace std; const double PI = 3.14159; int main() { int radius; double area; double circ; cout << "Type a -1 for radius to exit" << endl; cout << "Enter the radius: "; cin >> radius; while (radius >= 0) { circ = 2 * PI * radius; area = PI * pow(radius, 2); cout.setf(ios::fixed); cout.precision(1); cout << "A circle with radius " << radius << " has a circumference of " << circ << " and an area of " << area << endl << endl; cout << "Enter the radius: "; cin >> radius; } }

Please use C++ and use a bool function for the curcleCalculations

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions

Question

Recognize the power of service guarantees.

Answered: 1 week ago