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

Username:   Password: 
 RegisterRegister   
 Using a char without pressing enter
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
silvershadow




PostPosted: Sat Jun 03, 2006 7:43 am   Post subject: Using a char without pressing enter

im building a simple game, but im tired of having to type in words and pressing enter to do anything. i was hoping, to just press one single keyboard button, to make something take place.

code:

var choice : char

get choice

if choice = 'u' then
    guess := 1
    put "You bet under 7"
end if


that is not my full code, that is just a sample of it, which i shortened to help better understand my problem.

when the user has to enter their choice..they press a character, but then they have to press Enter after it in order for it to work. is it possible to edit my code so that way they wont have to press Enter? i just want the user to press the charactor and it automatically works.

thanks.
Sponsor
Sponsor
Sponsor
sponsor
TheOneTrueGod




PostPosted: Sat Jun 03, 2006 8:03 am   Post subject: (No subject)

code:

var ch : char %Also works with strings
ch := getchar
put ch
silvershadow




PostPosted: Sat Jun 03, 2006 8:42 am   Post subject: (No subject)

thanks alot, really appreciate it. Smile
TheOneTrueGod




PostPosted: Sat Jun 03, 2006 9:28 am   Post subject: (No subject)

No problem, thats what the help forum is here for Very Happy
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  [ 4 Posts ]
Jump to:   


Style:  
Search: