Computer Science Canada

Saving marks in an array program

Author:  uknown blank [ Tue Jan 19, 2010 5:49 pm ]
Post subject:  Saving marks in an array program

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>


Does anyone know how I can save amrks that are generated my the user in an array. I used counter to symbol each test entry. Also, if the user enters an invalid mark taht is more than 10 how can you make the counter stop. Suppose that on test 8 entry the user enters a -1 or 1 or 12 how do i make the counter stop.

Author:  Turing_Gamer [ Tue Jan 19, 2010 9:32 pm ]
Post subject:  Re: Saving marks in an array program

Very straight forward
Turing:
get input
for i : 1 .. input
    loop
        get num (i)
        if num (i) < 0 or i > 10 then
            put "invalid"
        else
            exit
        end if
    end loop
end for
for i : 1 .. input
    put "Entry " + intstr (i) + ": " + intstr (num (i))
end for


: