Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ beginner level please contains two calculations which you shall do using functions. 2. First write the program without using functions and run it with

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

C++ beginner level please

contains two calculations which you shall do using functions. 2. First write the program without using functions and run it with the test data. 3. After you have a working program write 2 functions: a. Replace the calculation to find the area of a right triangle with a call to a function which does the calculation. b. Replace the calculation to find the volume of a cone with a call to a function which does the calculation. - Recall that the volume of the cone can be generated by rotating the right triangle. The functions should use call by value and return the value for area and the value for volume. 4. The logic of the program is outlined in the comments (pseudocode) given below. Using the pseudocode, supply the appropriate C++ statements to create the program. Input the data from the screen and output to the screen. The test data is: The output is shown at the end of the assignment. 5. Test the program that uses function calls with the same test data. You should get the same results. // Functions Using Pass by Value // your Name \& Date / Ihis program finds the area of a right triangle and /l the volume of the cone generated by rotating the right triangle. // The height and base of the triangle are read from a file. // The height, base, area, and volume are written to a file. \#include \#include \#include using namespace std; I/ Function prototypes go here. int main () // declare the variables // declare the file objects / pseudocode 1. Read the base and height. 2. While more data do (Note: use a while loop) 2.a. Find the area of the right triangle. A=21bh 2.b. Find the volume of the cone. V=33.14r2h 2.c. Print the height, base, area, and volume to the output 2.d. Read the next base and height. 3 return 0; II Enter the code for the functions here, after main( ). Output: Base7.108.004.104.5012.80Height15.5023.405.3045.6024.30Area55.0293.6010.86102.60155.52Volume817.821567.4993.25966.494167.11 main.cpp Load default template... 123456789#includeusingnamespacestd;intmain(){/Typeyourcodehere.*/return0

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

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

Students also viewed these Databases questions