I'm trying to get my program to ask the user if they would like to return to the "main menu" after it has completed a calculation, but I can't figure out how to make it return to the top of the code.
which I believe is due to the fact that the returnToMainMenu variable is being declared inside the if statements individually, not outside.
Here's a link to the code that gives me that error (includes the do-while loop suggestion):
You should transfer the code for addition/subtraction etc. into seperate functions. It will make it simpler to read.
Get rid of the return 0; at the end of addition/subtraction etc. as it makes the program end immediately.
Then you should put the do while loop for invalid input in an else statement.
You need to declare a char variable "returnToMainMenu" and make the user input 'y' or 'n'.