1. Consider and study the program Circlefunction.cpp, modify the program to allow the user to display a circle's circumference, given its radius. Include the printing of circumference as number 3 selection. Create also a function for circumference.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
72
l l 12:44 s d
E Laboratory Activi...
AGUSAN DEL SUR STATE COLLEGE OF AGRICULTURE AND TECHNOLOGY
College of Engineering and Information Sciences
LABORATORY ACTIVITY No.6
1. Consider and study the program CircleFunction.cpp, modify the program to allow the user to display a circle's
circumference, given its radius. Include the printing of circumference as number 3 selection. Create also a
function for circumference.
Program Circlefunction.cpp
tinclude <<iostream>
tinclude <cmath>
using namespace std;
double getArea (double rad) ;
double getDiameter (double rad) ;
int main ()
6.
10
int choice = 0;
double radius = 0.0
11
12
cout << *1 circle area" < endl;
cout <« *2 circle diameter" << endl;
cout << "Enter your choice (1 or 2):";
cin >> choice;
13
14
15
16
17
18
if (choice <1 || choice > 2)
cout <« "Invalid choice" « endl;
else
19
20
21
22
23
cout <cendl<< "Enter the Radius: ";
cin >> radius;
if (choice 1)
cout << "The Area is:" << getArea (radius);
24
25
26
27
else
28
cout < "The Diameter is: " << getDiameter (radius):
29
//end if
30
31
32
33
cout < endl,
} //end if
return 0,
} //end of main function
34
35
//**...Eunction definitions*****
36
double getArea (double rad)
37
38 const double PI - 3.141593;
39 double area - 0.0;
40 area - PI * pow (rad, 2):
41 return area/
42 ) //end getArea function
43
44 double getDiameter (double rad)
45
46
return 2 rad,
//end getDiameter function
47
E4 - Computer Fundamentals and Programming
ructor: J. O. Balolot
Unit 7: Functions
AGUSAN DEL SUR STATE COLLEGE OF AGRICULTURE AND TECHNOLOGY
II
Transcribed Image Text:72 l l 12:44 s d E Laboratory Activi... AGUSAN DEL SUR STATE COLLEGE OF AGRICULTURE AND TECHNOLOGY College of Engineering and Information Sciences LABORATORY ACTIVITY No.6 1. Consider and study the program CircleFunction.cpp, modify the program to allow the user to display a circle's circumference, given its radius. Include the printing of circumference as number 3 selection. Create also a function for circumference. Program Circlefunction.cpp tinclude <<iostream> tinclude <cmath> using namespace std; double getArea (double rad) ; double getDiameter (double rad) ; int main () 6. 10 int choice = 0; double radius = 0.0 11 12 cout << *1 circle area" < endl; cout <« *2 circle diameter" << endl; cout << "Enter your choice (1 or 2):"; cin >> choice; 13 14 15 16 17 18 if (choice <1 || choice > 2) cout <« "Invalid choice" « endl; else 19 20 21 22 23 cout <cendl<< "Enter the Radius: "; cin >> radius; if (choice 1) cout << "The Area is:" << getArea (radius); 24 25 26 27 else 28 cout < "The Diameter is: " << getDiameter (radius): 29 //end if 30 31 32 33 cout < endl, } //end if return 0, } //end of main function 34 35 //**...Eunction definitions***** 36 double getArea (double rad) 37 38 const double PI - 3.141593; 39 double area - 0.0; 40 area - PI * pow (rad, 2): 41 return area/ 42 ) //end getArea function 43 44 double getDiameter (double rad) 45 46 return 2 rad, //end getDiameter function 47 E4 - Computer Fundamentals and Programming ructor: J. O. Balolot Unit 7: Functions AGUSAN DEL SUR STATE COLLEGE OF AGRICULTURE AND TECHNOLOGY II
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY