Right now I am working on a program that generates pseudo code from an activity diagram. I am working out some diagram scenarios and trying to put it into code to help me come up with a plan to code the translation. There is one that I can’t figure out how to do without using a goto statement and I know that as a rule of thumb C++ programmers are not supposed to use those. This is the code that best describes the graph
while(func1()==true)
{
func2();
while(func3()==true)
{
func4();
if(func5()==true)
{
goto g1;
}
}
func6();
}
g1:
func7();
Also, if I were to copy everything after the outer while loop into the if statement and then return like in the code below, it would be way too impractical.
while(func1()==true)
{
func2();
while(func3()==true)
{
func4();
if(func5()==true)
{
func7()
return;
}
}
func6();
}
func7();
Anyone know how I can do this? Is there a way I can use a double break or something?
[Edited by - ManaStone on August 18, 2008 3:14:23 AM]