Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

/ / Lab 1 0 - 1 . cpp - circle calculations / / Created / revised by on #include #include using namespace std; /

//Lab10-1.cpp - circle calculations
//Created/revised by on
#include
#include
using namespace std;
//function prototypes
void displayChoices();
void getArea(double rad, double &area);
void getDiameter(double rad, double &diameter);
int main()
{
int choice =0;
double radius =0.0;
double circleArea =0.0;
double circleDiameter =0.0;
displayChoices();
cout << "Enter your choice (1 or 2): ";
cin >> choice;
if (choice <1|| choice >2)
cout << "Invalid choice" << endl;
else
{
cout << "Radius: ";
cin >> radius;
if (choice ==1)
{
getArea(radius, circleArea);
cout << "Area: "<< circleArea;
}
else
{
getDiameter(radius, circleDiameter);
cout << "Diameter: "<< circleDiameter;
}//end if
cout << endl;
}//end if
return 0;
}//end of main function
//*****function definitions*****
void displayChoices()
{
cout <<"1 Circle area" << endl;
cout <<"2 Circle diameter" << endl;
}//end displayChoices
void getArea(double rad, double &area)
{
const double PI =3.141593;
area = PI * pow(rad,2);
}//end getArea function
void getDiameter(double rad, double &diameter)
{
diameter =2* rad;
}//end getDiameter function

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

Recommended Textbook for

Database Design Application And Administration

Authors: Michael Mannino, Michael V. Mannino

2nd Edition

0072880678, 9780072880670

More Books

Students also viewed these Databases questions

Question

How many three-digit numbers are divisible by 7?

Answered: 1 week ago

Question

What is Indian Polity and Governance ?

Answered: 1 week ago

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago