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

Username:   Password: 
 RegisterRegister   
 Inkey in turing
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
tum_twish




PostPosted: Tue Apr 22, 2003 9:49 am   Post subject: Inkey in turing

In QBasic, there is a command that will wait until a key is pressed.

code:

DO
         'expressions
LOOP WHILE inkey$=""


or

code:

DO
       'expressions
        SLEEP
LOOP UNTIL 'statement is true'



Is there a similar command in Turing that will wait until the key is pressed?[/code]
Sponsor
Sponsor
Sponsor
sponsor
tomako




PostPosted: Tue Apr 22, 2003 9:56 am   Post subject: (No subject)

im thinking getch, but i duno how u can wait til a "certain key"...
Blade




PostPosted: Tue Apr 22, 2003 10:51 am   Post subject: (No subject)

yeah use getch, with a loop... we'll use 'h' as the certian key your waiting for
code:
var anykey:string(1) %for getch the string has to be one character
loop
getch(anykey)
exit when anykey = "h"
put "Thats not the right key, you must press 'h'"
end loop


oh, and check out the tutorials section before you post help, it may clear up a lot of your problems
http://www.compsci.ca/bbs/viewforum.php?f=3
Homer_simpson




PostPosted: Tue Apr 22, 2003 11:59 am   Post subject: (No subject)

code:
var ch:char
loop
exit when getchar = "x"
end loop

"x" can be changed to character u want... Smile
Tony




PostPosted: Tue Apr 22, 2003 12:02 pm   Post subject: (No subject)

you for got to put getch inside the loop Confused And after that it would be exactly what Blade already said.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Delta




PostPosted: Tue Apr 22, 2003 1:45 pm   Post subject: (No subject)

Or use hasch for anykey to be waited upon

code:

loop
exit when hasch
end loop
Blade




PostPosted: Tue Apr 22, 2003 2:10 pm   Post subject: Re: Inkey in turing

tum_twish wrote:
In QBasic, there is a command that will wait until a key is pressed.

code:

DO
         'expressions
LOOP WHILE inkey$=""


or

code:

DO
       'expressions
        SLEEP
LOOP UNTIL 'statement is true'



Is there a similar command in Turing that will wait until the key is pressed?[/code]


he said he wanted one so that he can wait until a key is pressed, with hasch it keeps goin past it until a key is pressed
Homer_simpson




PostPosted: Tue Apr 22, 2003 2:55 pm   Post subject: (No subject)

why would u use getch command? (ch = getchar) does it all ... =/
Sponsor
Sponsor
Sponsor
sponsor
Office of the Registar




PostPosted: Fri Apr 25, 2003 9:13 am   Post subject: (No subject)

strings can be concatenated as well, maybe that's why use getch
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  [ 9 Posts ]
Jump to:   


Style:  
Search: