Just atarted learning C and I am experimenting with a simple "calculator"-program.
Now I want to add a question at the end to ask if the user wants to go again.
The code below compiles fine and calculations work but when its done it just prints the "do you want to continue" without letting the user decide and then just continues from the top.
#define PI 3.14
for (; ;)
// Welcoming the user and asks for input
printf("\n\t\tWELCOME TO THE GEOMETRYPWNER\n");
printf("\nPlease choose a shape to calculate:\n\n");
printf("1.Area of circle\n2.Surface of cylinder\n
printf("3.Square Root of a number\n4.Multiplication\n\n");
printf("Enter input: ");
// input chooses what function to call, else print error message.
case 1: circle(); break;
case 2: cylinderArea(); break;
case 3: squareRoot(); break;
case 4: multiplication(); break;
default: printf("Error in input"); break;
// Asks user if he/she wants to try again. Y continues, N quits the program
printf("\nWant to try again? Y/N");
if (g == 'y' || g == 'Y')
else if (g == 'n' || g == 'N')