I have created a BMI program in C# which is menu driven; the menu needs to be displayed repeatedly until the option to quit is selected. I have the program working and it is calculating both metric and imperial and it also exits when the number 3 is pressed which is great. However I cannot get the menu to display repeatedly.
Any guidance to help me resolve this would be greatly appreciated. "No errors showing on VSE 2010".
Sample Dialogue
Main Menu
1. Metric
2. Imperial
3. Quit
Enter choice : 1
Enter Height in meters 1.8
Enter Weight in Kg 60
Your BMI is 18.5
This indicates that you are of Normal weight. // the program works as it should to this point.
Main Menu // this is where the problem is, getting this "Main Menu" or block of code to repeat unless option 3 is selected.
1. Metric
2. Imperial
3. Quit
{ // this is my attempt at the loop but i cant get it to work
int menuchoice = 0;
while (menuchoice != 3) // the loop stays in the loop until 3 is pressed?
switch (menuchoice)
{
}
break;
}
}
}
}

New Topic/Question
Reply



MultiQuote




|