
(a)
To write a function that calculate the area of a circle. It call another function to get the radius of the circle. The circumference of the circle is given.
(a)

Explanation of Solution
The name of the function is area().
This function has one parameters.
The parameter will accept afloating number to get the circumference (c) of a circle.
It call another function named radius () to get the radius (r) of the circle.
This function has one parameters.
The parameter will accept a floating number to get the circumference (c) of a circle.
The formula to calculate the radius of the circle is c / 2π.
The formula to calculate the area of the circle is πr2.
The function definition is:
float radius (float circumference) { //variable declaration float r; //calculate radius of the circle r = c / (2 * PI); //return radius return r; } //function to calculate area void area (float c) { //variable declaration float a, r; //get the radius of the circle by calling the function r = radius(c); //calculate area of the circle a = PI * pow (r, 2); //display radius of the circle cout<<"The radius of the circle is: "<< r <<endl; //display area of the circle cout<<"The area of the circle is: "<< a; }
(b)
- c,r,andavariables are used in the program.
- area () function is include in the program to calculate and display the area of the circle.
- radius () function is include in the program tocalculate and return the radius of the circle.
Program Description: The main purpose of the program is to prompt the user to enter the circumference of a circle to calculate the radius and the area of that circle. Include the function named area() in the main program. Call the function from the main () function with the value of the circumference of a circle.
(b)

Explanation of Solution
Program:
//including essential header file #include <iostream> #include <cmath> //define the value of PI (p) #define PI 3.14 //using standard namespace usingnamespace std; //function to calculate radius float radius (float circumference) { //variable declaration float r; //calculate radius of the circle r = circumference / (2 * PI); //return radius return r; } //function to calculate area void area (float c) { //variable declaration float a, r; //get the radius of the circle by calling the function r = radius(c); //calculate area of the circle a = PI * pow (r, 2); //display radius of the circle cout<<"The radius of the circle is: "<< r <<endl; //display area of the circle cout<<"The area of the circle is: "<< a; } //main function intmain() { //variable declaration float c; //prompt the user to enter the circumference of the circle cout<<"Enter the circumference of the circle: "; //get the circumference from the user cin>> c; //call the function area (c); return 0; }
Explanation: In the above code, themain() function is to prompt the user to enter the circumference of a circle. The user-entered circumference is stored in the variable named c. Then the main()function call a function named area()with the value of the circumference to calculate and display the radius and area of the circle. The function named area()has one parameter named c. The parameter named c stores the circumference of a circle passed by the main () function. The function namedarea()called another function to get the radius of the circle. Call the function named radius () with the circumference of a circle. The function named radius ()Calculate the radius of the circle by the given formula and return the radius of the circle.The function namedarea() calculates the area of the circle by the given formula and display the radius and area of the circle.
Sample Output:
Want to see more full solutions like this?
Chapter 6 Solutions
C++ for Engineers and Scientists
- Discussion 1. Comment on your results. 2. Compare between the practical and theoretical results. 3. Find VB, Vc on the figure below: 3V V₁₁ R₁ B IR, R, IR, R www ΙΚΩ www www I 1.5KQ 18₁ 82002 R₁ 3.3KQ R₂ 2.2KQ E Darrow_forwardAgile1. a. Describe it and how it differs from other SDLC approachesb. List and describe the two primary terms for the agile processc. What are the three activities in the Construction phasearrow_forwardhow are youarrow_forward
- need help with thi Next, you are going to combine everything you've learned about HTML and CSS to make a static site portfolio piece. The page should first introduce yourself. The content is up to you, but should include a variety of HTML elements, not just text. This should be followed by an online (HTML-ified) version of your CV (Resume). The following is a minimum list of requirements you should have across all your content: Both pages should start with a CSS reset (imported into your CSS, not included in your HTML) Semantic use of HTML5 sectioning elements for page structure A variety other semantic HTML elements Meaningful use of Grid, Flexbox and the Box Model as appropriate for different layout components A table An image Good use of CSS Custom Properties (variables) Non-trivial use of CSS animation Use of pseudeo elements An accessible colour palette Use of media queries The focus of this course is development, not design. However, being able to replicate a provided design…arrow_forwardUsing the notationarrow_forwardyou can select multipy optionsarrow_forwardFor each of the following, decide whether the claim is True or False and select the True ones: Suppose we discover that the 3SAT can be solved in worst-case cubic time. Then it would mean that all problems in NP can also be solved in cubic time. If a problem can be solved using Dynamic Programming, then it is not NP-complete. Suppose X and Y are two NP-complete problems. Then, there must be a polynomial-time reduction from X to Y and also one from Y to X.arrow_forwardMaximum Independent Set problem is known to be NP-Complete. Suppose we have a graph G in which the maximum degree of each node is some constant c. Then, is the following greedy algorithm guaranteed to find an independent set whose size is within a constant factor of the optimal? 1) Initialize S = empty 2) Arbitrarily pick a vertex v, add v to S delete v and its neighbors from G 3) Repeat step 2 until G is empty Return S Yes Noarrow_forwardPlease help me answer this coding question in the images below for me(it is not a graded question):write the code using python and also provide the outputs requiredarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning

