Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A C++ Program = Modularizing a Program with void Functions Step 1: Modularize the program by adding the following 4 functions. None of them have

A C++ Program = Modularizing a Program with void Functions

Step 1: Modularize the program by adding the following 4 functions. None of them have any parameters.

void displayMenu()

void findSquareArea()

void findCircleArea()

void findTriangleArea()

To do that you will need to carry out the following steps:

Write prototypes for the four functions and place them above main.

Write function definitions (consisting of a function header and initially empty body) for the four functions and place them below main.

Move the appropriate code out of main and into the body of each function.

Move variable definitions in main for variables no longer in main to whatever functions now use those variables. They will be local variables in those functions. For example, findSquareArea will need to define the side variable and findCircleArea will need to define the radius variable. All of the functions that compute areas will now need to define a variable named area.

Move the definition for the named constant PI out of main and place it above the main function.

In main, replace each block of removed code with a function call to the function now containing that block of code.

Step 2: Compile the code, Make sure it runs correctly for all menu choices.

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

Step: 3

blur-text-image

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

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago