Question: Create C++ code, using the psuedocode: 1. Declare a global constant named PI equal to 3.141592; 2. Declare variables named base, height , radiusa ,

Create C++ code, using the psuedocode:

1. Declare a global constant named PI equal to 3.141592; 2. Declare variables named base, height, radiusa, radiusb, rec_area, and elli_area that hold real numbers. 3. Print on the screen For the rectangle 4. Call void function getData(base, height) that gets two lengths from the keyboard and returns them to main( ). 5. Print on the screen For the ellipse 6. Call void function getData(radiusa, radiusb) that gets two lengths from the keyboard and returns them to main( ). 7. Calculate the area of the rectangle and store the result in rec_area. 8. Calculate the area of the ellipse and store the result in elli_area. 9. Call void function printData(rec_area, elli_area) that receives the two areas and prints on the screen the message:

"The area of the rectangle is ", rec_area "The area of the ellipse is ", elli_area

Function getData(rpar1, rpar2 ) must: 1. Prompt the user to "Please enter two lengths: "

2. Get both values from the keyboard and store them in rpar1 and rpar2. Note: rpar1 and rpar2 are reference parameters.

Function printData(vpar1, vpar2) must: 1. Format the output to display the numbers in fixed format with one decimal digit.

2. Print the message on the screen.

Note: vpar1 and vpar2 are value parameters.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!