
-----------------------------------
ProgrammingFun
Tue Jan 12, 2010 8:08 pm

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.  :shock: 


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)




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

-----------------------------------
Zren
Tue Jan 12, 2010 8:49 pm

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.


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
Tue Jan 12, 2010 8:51 pm

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
Wed Jan 13, 2010 7:54 am

RE:Getch Command Confusion
-----------------------------------
Thanks!  This should make my life easier.
