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
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...
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 2 images
Knowledge Booster
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.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr