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

Username:   Password: 
 RegisterRegister   
 GrandMicky's... some other thread
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GrandMicky




PostPosted: Thu May 27, 2010 7:11 pm   Post subject: RE:Frequently Asked Questions (And Answers!)

after the program runs through a certain number of times, hopw do i show how many times the program was used
var name : string
var grade : string
loop
put "Welcome to High School Grad Program"
put "Enter your name now"
get name
put "Hello,", name, "what grade are you in?"
put "Are you in grade 9, 10, 11, or 12"
get grade
if grade = "12" then
put name, ", you are able to graduate!!!"
put "Congratulations!!!"
elsif grade = "9" then
put name, ", you are not able to graduate yet."
put "Too bad"
elsif grade = "10" then
put name, ", you are not able to graduate yet."
put "Too bad"
elsif grade = "11" then
put name, ", you are not able to graduate yet."
put "Too bad"
end if
end loop

i want to know how to show the user how many times the program has run through completely after several inputs have been made.
Sponsor
Sponsor
Sponsor
sponsor
Insectoid




PostPosted: Thu May 27, 2010 7:13 pm   Post subject: RE:Frequently Asked Questions (And Answers!)

Add a counter variable equal to zero at the beginning. At the bottom of the loop, add 1 to it.
Tony




PostPosted: Thu May 27, 2010 7:20 pm   Post subject: RE:GrandMicky\'s... some other thread

@GrandMicky -- quit posting your personal questions to old tutorial threads.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: