GrandMicky's... some other thread
Author |
Message |
GrandMicky
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Insectoid
![](http://compsci.ca/v3/uploads/user_avatars/13760332514cbd0ce972eaa.jpg)
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Tony
![](http://wiki.compsci.ca/images/f/f4/OniTony.gif)
|
Posted: 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. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
![](images/spacer.gif) |
|
|