Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Saving marks in an array program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
uknown blank




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
Turing_Gamer




PostPosted: 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
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: