I have a Menu program that's fairly large and uses goto statements. It works fine this way. I want to get the goto statements out of the code. For the past ( I lost count ) how many hours I have been STFM, searching the board history, and tinkering with small programs to try and figure out a way to do it for ths program. I have tried if, while, and function tests galore.
Program is setup the following way:
== menu 1 ==
sub menu 1
sub menu 2
sub menu 3
== execution menus ==
A choice between 3 executions of external programs through a predifined function with the selection's specific arguments passed to it.
Some sub menus lead to further sub menus, while others present a choice of options to pass to a command line program(execution menu). It's sort of like a front end for a program that has no interface.
I had the program working "almost" to perfection with a switch / case structure.
Go back to previous menu
Undefined selection, repeat menu
Escape was chosen, close program.
I was using getch() to grab the selection, and char choice; to hold it. The program didn't seem to like the 3 choices above all that well. It got awfully buggy.
If anyone can help or point out some ideas or solutions, it'd be appreciated. I know I don't want to use goto statements, that's for sure.