Hello Feedest,
Line 5:
void choice1(),choice2(),choice3();
I did not think this would work, but it seems to. Generally I see a prototype for a function on separate lines.
I see that you have removed the "continue". "continue" works in for loops,do/while loops and while loops to pass over code to get back to the condition of the loop.
If the format you are using for the else/if statements works for you that is fine, but I most often see them written as:
1 2 3 4
|
else if (a == 'b' || a == 'B')
{
choice2();
}
|
The compiler does not care about the amount ofwhite space between the "else" and the "if".
The goto in "main" can be replaced with a do/while loop.I would add a forth choice to the menu for "Exit" and the while condition might be
while (std::toupper(a)!='D');
. The "std::toupper()" comes from the header file "cctype". Just a thought. This way you will stay in the loop until you choose "D" and the loop ends. this way you can replace the goto that you are using. The goto may appear to be easy, but you are not using it the way you should.
Hints/suggestions: Use better names for variables and functions. The names make no difference to the compiler, but it does make it easier for someone reading your code. "cin >>a" may work, but "cin >> choice" makes more sense when reading. Someone once said, sorry I do not recall who at the moment, a variable name should be a noun to that I add it should describe what the variable is or does. The same applies to function names. "AreaOfaShape" makes more sense than "choice1". Just little things, but you will find it useful in the future.
Hope that helps,
Andy