Pseudocode For Statement


K

Krisitne

I need to use a for statement to write some pseudocode. I am not sure
how to actually write it - using a for loop. Could someone please give
me an example of what a for statment would look like in pseudocode?



Thankyou
 
Ad

Advertisements

C

code_wrong

Krisitne said:
I need to use a for statement to write some pseudocode. I am not sure
how to actually write it - using a for loop. Could someone please give
me an example of what a for statment would look like in pseudocode?


for each doodaad
dosome stuff
end for
 
Ad

Advertisements

M

Malcolm

Krisitne said:
I need to use a for statement to write some pseudocode. I am not sure
how to actually write it - using a for loop. Could someone please give
me an example of what a for statment would look like in pseudocode?
pseudocode is a specification of an algorithm which is designed to be human-
rather than machine- readable.

How you would specify a for loop depends on your human audience. If they are
experienced C programmers, you would probably use the C syntax. On the other
hand if they are beginning programmers who are just learning about loops,
you would write something like.

counter is called i;
set i to initial value (usually zero)

loop label here:
do_something, possibly using i;
change i, (usually, add 1 to it)

if a condition involving i is true (usually, is i < N)
jump to loop label

for loop ends here.
 

Top