Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Question 1(5pt): pyramid, surface area A Pyramid with a square base, 4 triangular faces, and an apex is a square pyramid. Write a function
C++
Question 1(5pt): pyramid, surface area A Pyramid with a square base, 4 triangular faces, and an apex is a square pyramid. Write a function surfaceArea to calculate and return the surface area of a square pyramid. The function takes two double parameters - the base length(b) and slant height(h) of a square pyramid, and calculates and returns the surface area as a double. Function specifications: The function name: surfaceArea The function parameters (in this order) o The base length, double o The slant height, double The function return value: surface area, double The function should not print anything. Edge cases: if one or more arguments are not positive numbers, then it should return -1 Sample run 1 (bold is user input) Enter the base length: 3 Enter the slant height: 4 The surface area: 33 Sample run 2 (bold is user input) Enter the base length: 3 Enter the slant height: -1 Invalid valuesStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started