
-----------------------------------
uknown blank
Tue Jan 19, 2010 5:49 pm

Saving marks in an array program
-----------------------------------
What is it you are trying to achieve?



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.

-----------------------------------
Turing_Gamer
Tue Jan 19, 2010 9:32 pm

Re: Saving marks in an array program
-----------------------------------
Very straight forward
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
