Flowcharts

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?
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
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


If i just take the outer. (start) - [ j = 0 ] - <while ( j < 4 ) - [ cout << "*";] [ j++ ] - ( stop )

it would look something like this:

http://www.tenouk.com/clabworksheet/labworksheet7_files/cdowhileflowchart109.png

how do i draw a loop inside this?
Last edited on
Last edited on
Topic archived. No new replies allowed.