Computer Science Canada Help 2. |
Author: | Thanos [ Mon Sep 16, 2002 8:04 pm ] |
Post subject: | Help 2. |
Hey, I was wondering what command I would use to assign a specific get command to a certain key. For example: put "Hit the space bar to get your answer" I want it so that everytime i hit the space bar (or any key) i will get the desired answer. Any help would be appreciated. |
Author: | Tony [ Mon Sep 16, 2002 8:31 pm ] | ||
Post subject: | maybe its this | ||
I'm a bit consufed but here's I think is what you're looking for.
this will promp the user to enter their name, after it was entered and return key is pressed, whatever was entered will be assigned to the variable name I hope this is what you're looking for. I think Dan posted a tutorial on I/O, take a look there. |
Author: | Dan [ Tue Sep 17, 2002 2:40 pm ] | ||||
Post subject: | hummmm | ||||
if you whont it so you hit any key and dont need an enter you do this:
the vlaue of the key hit is stored in the var but it can only be one char long. to make it so it conutes when space is hit you coude do this:
this code will only exit when the space bar is hit. to make it nicer you coude add cls insted of the 1st put. |
Author: | Thanos [ Tue Sep 17, 2002 5:32 pm ] |
Post subject: | |
Thanks for all the help guys! Btw, does the "exit when" command only work with loops? |
Author: | Tony [ Tue Sep 17, 2002 6:48 pm ] | ||
Post subject: | |||
exit when works for all loops, regular and for loop.
will output only first 5 numbers then exit. |