Oct 24, 2011 at 5:08pm UTC
Okay so I have an exam tomorrow and really need to get this writing flowcharts down.
I know all the symbols and can do simple ones but when there is "a while inside a while" my mind just go blank.
Example:
Procedure 15()
{
j = 0
while( j < 4 )
{
i = 0
while( i < j )
{
cout << " ";
i++
}
cout << "*" << endl;
j++
}
return 0;
}
how do I make a flowchart out of this?
Oct 24, 2011 at 5:22pm UTC
Maybe looking at it another way will help...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
OUTER_LOOP: {
if ( j < 4 ) {
i = 0;
INNER_LOOP: {
if ( i < j ) {
print " " ;
i++;
goto INNER_LOOP;
}
}
print "*" ;
print newline;
goto OUTER_LOOP;
}
}
Last edited on Oct 24, 2011 at 5:23pm UTC
Oct 24, 2011 at 5:51pm UTC
Thanks!
Got it and all and could write out the answer... but how do I draw a loop inside a loop? It's just like having trouble translating from languages :D
Oct 24, 2011 at 6:06pm UTC
Last edited on Oct 24, 2011 at 6:07pm UTC
Oct 24, 2011 at 6:30pm UTC
Last edited on Oct 24, 2011 at 6:36pm UTC