Hello everybody this is my first time posting here, and first time learning c++.
I am having trouble with my homework assignment where I am supposed to write four
functions that return the area of a circle, cylinder , and volumes of a cone and cylinder. The problem that I am having is with my output. whenever I enter in a radius and height all of my functions return just a 1. If you want to flame my code or my post go ahead. Criticism can be a good thing.
Please use code tags. It makes code easier to read. They are the "<>" on right side of text box.
3 things
1. You forgot to return a value from your areaCircle function.
2. It's bad practice to use system("PAUSE");.
3. You need to pass the variable to all your functions. For example your first output using a function would look like cout << " The area of a circle is : " << areaCircle(radius) << endl;. You will need to fix the rest of your function calls.
Nothing's wrong with std::system() in the general case, however, it's important to know what it does:
a.) its behavior depends on the system's environment -- it can be a security risk, and unreliable;
b.) it takes an otherwise portable program and makes it less portable.
Also, keep in mind that non-interactive use and versatility is the greatest strength of a command-line interface, and forcing someone to press (or simulate) a keystroke to use your program seriously impedes its usefulness.