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

Username:   Password: 
 RegisterRegister   
 press any key
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
air_force91




PostPosted: Fri Jan 09, 2004 5:40 pm   Post subject: press any key

now...if i want my title page to include "press any key to continue..." for a key to be pressed and the user to be taken to the next page...what command do i use?
Sponsor
Sponsor
Sponsor
sponsor
recneps




PostPosted: Fri Jan 09, 2004 5:47 pm   Post subject: (No subject)

either....
code:
loop
exit when hasch
end loop

or
code:
Input.Pause

the way it is written for hasch, will stop the program until a key is pressed(because it is processing and "empty" loop) but you can include in another loop, say to exit at any time.
Input.Pause just stops everything until a key is pressed. you dont need to hit enter for either
santabruzer




PostPosted: Fri Jan 09, 2004 6:40 pm   Post subject: (No subject)

why not just use:
code:
var ch : string (1)
getch (ch)
McKenzie




PostPosted: Fri Jan 09, 2004 6:45 pm   Post subject: (No subject)

Santa's solution is better. The problem with just using hasch is that the key will not be processed...meaning that it won't work if you try it again (because hasch will still be true)
DanShadow




PostPosted: Fri Jan 09, 2004 6:52 pm   Post subject: (No subject)

wow, your right....it wont work again. I forgot to take into account that the input buffer already has a key from the last loop, and is therefore carried on to the next loop....very perseptive Mckenzie! So just go forth and use the *getch (key )* command...it alwa ys works...or combine them:
code:

if hasch then
getch(key)
end if
Andy




PostPosted: Fri Jan 09, 2004 8:00 pm   Post subject: (No subject)

well considering hes a compsci teacher... and marks only codes he kinda has to
DanShadow




PostPosted: Fri Jan 09, 2004 8:15 pm   Post subject: (No subject)

(psst) Dodge, I think your wrote that in the wrong topic (psst)
And yes...he kind of has to. CompScience gets very boring when your marking kids' programs which you can usually do 100x better...
Andy




PostPosted: Fri Jan 09, 2004 8:36 pm   Post subject: (No subject)

? i was talking about mckenzie and the fact that you said he was very perseptive
recneps




PostPosted: Fri Jan 09, 2004 9:04 pm   Post subject: (No subject)

see but you can have multiple

loop
exit when hasch
end loop

's so that itll stop at that one spot.. and if he doesnt need the char for anythin, input.pause is faster to write Smile, with no variable needed
CITC




PostPosted: Fri Jan 09, 2004 9:09 pm   Post subject: (No subject)

so mackenzie using Input.Pause won't work more than once either?
also isn't there a command or a way of emptying the characters that have been inputed?
recneps




PostPosted: Fri Jan 09, 2004 9:44 pm   Post subject: (No subject)

whats the program being made? is it like

code:
drawoval(x,y,25,25,7)
put "Press any Key to continue."
%code here(whichever method you use)
draw box(x1,y1,x2,y2,7)



because if so, Input.Pause works, you dont need to declare a variable, and you dont need a loop or anything.
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  [ 11 Posts ]
Jump to:   


Style:  
Search: