So the purpose of this program is to use functions, nested decisions, and sentinel loops to calculate the surface area, volume, or "Girth + Depth" of a box. I saw many ways to do it on this forum but none of them use functions. The input should be the letter "v" to indicate volume, "a" for surface area, "g" for girth + depth, and "q" to stop the loop (sentinel). Second part of the input should be three (float) numbers representing Length, Width, and Depth.
Please help. This is due in a matter of hours and I would really, really appreciate help. Just a shell even. I know how to do this, but I don't know how to do it using functions.
Ahh! Thanks for your reply! Could you please give me an example? I missed a week from school so I'm totally lost. Like an example of calling it from the main.
to call it from the main you would just need to write the function and pass it the parameters:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
int main()
{
float L, W, D;
float V;
//get the data from the user using a while loop
V = CalculateVolume(L, W, D);
//output the volume.
//do some other stuff
return 0;
};
Do I need to put the formula for finding the volume in the function prototype? Like I don't even know how functions really work. Will the function CalculateVolume calculate the volume? Or do I need to give it the formula for doing that when I declare it
Honestly if someone could just write this program for me... I'd be the happiest person alive. And would contribute lots to the forum once I learned my shit, lol.
So far I have this. The functions are all working. Now I need to create a sentinel controlled while loop and use user input of Volume, Girth + Depth, and Surface Area to determine which function gets used.