Question: In C++ write a function Vol that takes in three parameters and returns the volume of a rectangular pyramid. Then overload Vol to take
In C++ write a function Vol that takes in three parameters and returns the volume of a rectangular pyramid. Then overload Vol to take to take in two parameters (double) and return the volume of a square pyramid. Test the overloaded function Vol in your main function by calling each of them with its arguments. Test case below Welcome to the pyramid calculator! Please enter 's' for square pyramid or 'r' for rectangular: s You chose square! Please enter a length and height, separated by a space: 4.5 6.8 The volume of the pyramid whose attributes you entered is: 45.9 Would you like to continue using this program? (y/n) y Welcome to the pyramid calculator! Please enter 's' for square pyramid or 'r' for rectangular: r You chose rectangular! Please enter a length, width, and height, separated by spaces: 5.7 11.34 9.3 The volume of the pyramid whose attributes you entered is: 200.378 Would you like to continue using this program? (y/n) n Thank you for using the pyramid volume calculator. Bye!
Step by Step Solution
3.44 Rating (157 Votes )
There are 3 Steps involved in it
Here is the C code that calculates the volume of a rectangular pyramid and a square pyramid C include using namespace std Function to calculate the volume of a rectangular pyramid double volRectangula... View full answer
Get step-by-step solutions from verified subject matter experts
