Computer Science Canada What does? |
Author: | nin [ Thu Dec 14, 2006 5:44 pm ] |
Post subject: | What does? |
what does programTitle store? what does the or command do? how does the command title ("Random Numbers") work? ------------------------------------------------------------------------------------- Code: %Random Numbers %Declaration Sectiom var number : int %program Title procedure title (programTitle : string) var len : int := length (programTitle) cls locate (1, 40 - len div 2) put programTitle put " " end title procedure displayRand title ("Random Numbers") randint (number, 110, 135) put "A random number from 110 to 135 is: ", number delay (300) end displayRand loop displayRand exit when number = 121 or number = 130 end loop |
Author: | Hackmaster [ Thu Dec 14, 2006 9:37 pm ] |
Post subject: | |
Well, the guy who programmed this is Either trying to demonstrate a point, ... or is just a moron. These procedures are custom made. the first one takes a string as input, and just outputs it to the screen. the second one generates a random number, and then it outputs it as well. There is a good chance that the reason you are asking this is becuase you don't really know what procedures are, and I invite you to look up my tutorial on the subject, titled "A little tutorial about procedures" in the turing help section. then again, it was my first post, so maybe, you might read someone elses. I hope that helped! |
Author: | uberwalla [ Thu Dec 14, 2006 9:57 pm ] |
Post subject: | |
ok so basically the procedure 'programTitle' is a long way of putting a title onto the screen. the 'or' statement just says that if something is either blah OR blah then do this or that... if that makes sence. its basic english ![]() and title ("Random Numbers") calls upon the procedure. title calls the procedure and ("Random Numbers") is the variable the procedure wants so it can run. procedure title *****(programTitle : string) **** in between the stars is what the procedure calls for to run. which since it is string had to have the quotations. |
Author: | CodeMonkey2000 [ Thu Dec 14, 2006 10:55 pm ] |
Post subject: | |
next time please refer to the Turing Walkthrough http://www.compsci.ca/v2/viewtopic.php?t=8808 |
Author: | NikG [ Thu Dec 14, 2006 11:45 pm ] |
Post subject: | |
Is it just me, or does that look like a question from a test/assignment? |
Author: | Clayton [ Fri Dec 15, 2006 9:56 am ] |
Post subject: | |
If it's from an assignment I find that pretty sad |