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

Username:   Password: 
 RegisterRegister   
 Getch Command Confusion
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ProgrammingFun




PostPosted: Tue Jan 12, 2010 8:08 pm   Post subject: Getch Command Confusion

What is it you are trying to achieve?
I am trying to code my program to automatically proceed after the user has entered their choice without waiting for them to press enter.


What is the problem you are having?
I am creating a quiz on Turing. I want the program to automatically go to the next question when the user enters a choice instead of having to wait for them to press enter. I have checking the Tutorials but I do not understand most of it. I do know that this has something to do with the getch command. Shocked


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


var ans1, ans2, ans3: int

put "This is the question."
put "choice 1 \n choice 2 \n choice 3."
put "I choose this "..
getch ans1..
put " answer."

%and so on



Please specify what version of Turing you are using
4.1.1
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Tue Jan 12, 2010 8:49 pm   Post subject: RE:Getch Command Confusion

Getch is a procedure. And the type must be :string(1). Here's a basic use. I've also included some basic conversion of strings to numbers for the hell of it.

Turing:

var responce : string
put "What is it my young padawan?"
get responce
put "Is that so. Well you can continue to ", responce,"."


var press : string (1)
put "Wait here for a moment and press Enter when you need me."
getch (press)
put "You DARE interupt me!"

var answer:string(1)
put "Answer this! How many legs does a dog have?"
getch(answer)

var number : int
if strintok (answer) then
    number := strint(answer)
end if
TerranceN




PostPosted: Tue Jan 12, 2010 8:51 pm   Post subject: RE:Getch Command Confusion

You should look at the Turing Refrence. In Turing, click Help->Turing Refrence->Search, type in getch, double click on getch on the left side, read about getch.

EDIT : Whenever I type something to post, someone beats me to it...
ProgrammingFun




PostPosted: Wed Jan 13, 2010 7:54 am   Post subject: RE:Getch Command Confusion

Thanks! This should make my life easier.
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: