Using User-defined Functions with return statement Create a program that will use user-defined functions that return a value. NOTE: Create a program that will compute for the area of square, rectangle, triangle and circle. Use user defined function for each shape. Any number divided by zero will result to undefined. Formulas: Square Area = s² Rectangle Area = w * l Triangle Area = (h * b) / 2 Circle Area = πr² where: π = 3.1416 NOTE: Your source code must display any of the given sample output below. It means your source code should be flexible enough to meet any of the given sample output. Your source code output must be identical to any of the given sample output. It means you have to strictly follow what are the displayed text, labels, casing of characters in the sample output. Sample OUTPUT 1 AREA MENU [1] Square [2] Rectangle [3] Triangle [4] Circle Option: 1 Side: 10 Area: 100 Sample OUTPUT 2 AREA MENU [1] Square [2] Rectangle [3] Triangle [4] Circle Option: 2 Length: 10 Width: 5 Area: 50 Sample OUTPUT 3 AREA MENU [1] Square [2] Rectangle [3] Triangle [4] Circle Option: 3 Base: 40 Height: 10 Area: 200 Sample OUTPUT 4 AREA MENU [1] Square [2] Rectangle [3] Triangle [4] Circle Option: 4 Radius: 20 Area: 1256.64

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter6: Modularity Using Functions
Section6.2: Returning A Single Value
Problem 2E: (Practice) For the following function headers, determine the number, type, and order (sequence) of...
icon
Related questions
Question

Using User-defined Functions with return statement

Create a program that will use user-defined functions that return a value.

NOTE:
Create a program that will compute for the area of square, rectangle, triangle and circle.
Use user defined function for each shape.
Any number divided by zero will result to undefined.
Formulas:
Square Area = s²
Rectangle Area = w * l
Triangle Area = (h * b) / 2
Circle Area = πr² where: π = 3.1416
NOTE:
Your source code must display any of the given sample output below.
It means your source code should be flexible enough to meet any of the given sample output.
Your source code output must be identical to any of the given sample output.
It means you have to strictly follow what are the displayed text, labels, casing of characters in the sample output.
Sample OUTPUT 1
AREA MENU
[1] Square
[2] Rectangle
[3] Triangle
[4] Circle
Option: 1
Side: 10
Area: 100
Sample OUTPUT 2
AREA MENU
[1] Square
[2] Rectangle
[3] Triangle
[4] Circle
Option: 2
Length: 10
Width: 5
Area: 50
Sample OUTPUT 3
AREA MENU
[1] Square
[2] Rectangle
[3] Triangle
[4] Circle
Option: 3
Base: 40
Height: 10
Area: 200
Sample OUTPUT 4
AREA MENU
[1] Square
[2] Rectangle
[3] Triangle
[4] Circle
Option: 4
Radius: 20
Area: 1256.64
Expert Solution
steps

Step by step

Solved in 3 steps with 4 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning