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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top