Ask Question
19 April, 08:07

Define a function pyramid volume with double parameters baselength, basewidth, and pyramid height, that returns as a double the volume of a pyramid with a rectangular base. relevant geometry equations: volume = base area x height x 1/3 base area = base length x base width. (watch out for integer division).

+3
Answers (1)
  1. 19 April, 08:34
    0
    Declaring the volume function double PyramidVolume (double baseLength, double baseWidth, double pyramidHeight) { double baseArea = baseLength * baseWidth; double vol = ((baseArea * pyramidHeight) * 1/3); return vol; } int main () { cout << "Volume for 1.0, 1.0, 1.0 is: " << PyramidVolume (1.0, 1.0, 1.0) << endl; return 0; } Defining the function, include double PyramidVolume (double, double, double); int main () { std::cout << "Volume for 1.0, 1.0, 1.0 is: " << PyramidVolume (1.0, 1.0, 1.0) << std::endl; return 0; } double PyramidVolume (double length, double width, double height) { return length * width * height / 3; }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Define a function pyramid volume with double parameters baselength, basewidth, and pyramid height, that returns as a double the volume of a ...” in 📗 Mathematics if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers