a. The main part of the program will call a user-defined function. b. Inside the function do the following: a. Prompt and have the user input the height of the triangle b. Prompt and have the user input the length of the base of the triangle c. Calculate the area of the triangle based on this, i.e. .5* (h* b) d. Pass the area back to the main part of the program c. The main part of the program will then produce the final output, i.e. area of the triangle as shown in the sample run below. Display the area with two digits to the right of the decimal place. In the example below, the user entered 10 as the height of the triangle and the user entered 5 as the length of the base of the triangle. The program then outputted the area as being 25.00. Sample run: Enter length of height of triangle: 10 Enter length of base of triangle: 5 The area of the triangle is: 25.00

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter6: User-defined Functions
Section: Chapter Questions
Problem 1TF: Mark the following statements as true or false: a. To use a predefined function in a program, you...
icon
Related questions
Question
a. The main part of the program will call a user-defined function.
b. Inside the function do the following:
a. Prompt and have the user input the height of the triangle
b. Prompt and have the user input the length of the base of the triangle
c. Calculate the area of the triangle based on this, i.e. .5 * (h* b)
d.
Pass the area back to the main part of the program
c. The main part of the program will then produce the final output, i.e. area of the triangle as
shown in the sample run below. Display the area with two digits to the right of the decimal
place.
In the example below, the user entered 10 as the height of the triangle and the user entered 5 as
the length of the base of the triangle. The program then outputted the area as being 25.00.
Sample run:
Enter length of height of triangle: 10
Enter length of base of triangle: 5
The area of the triangle is: 25.00
Program organization:
User-Defined Function
Function call
Output
User Input and Process
Transcribed Image Text:a. The main part of the program will call a user-defined function. b. Inside the function do the following: a. Prompt and have the user input the height of the triangle b. Prompt and have the user input the length of the base of the triangle c. Calculate the area of the triangle based on this, i.e. .5 * (h* b) d. Pass the area back to the main part of the program c. The main part of the program will then produce the final output, i.e. area of the triangle as shown in the sample run below. Display the area with two digits to the right of the decimal place. In the example below, the user entered 10 as the height of the triangle and the user entered 5 as the length of the base of the triangle. The program then outputted the area as being 25.00. Sample run: Enter length of height of triangle: 10 Enter length of base of triangle: 5 The area of the triangle is: 25.00 Program organization: User-Defined Function Function call Output User Input and Process
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Types of Function
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++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr