Getch Command Confusion
Author |
Message |
ProgrammingFun
![](http://compsci.ca/v3/uploads/user_avatars/11682880074bcb590d30b0a.png)
|
Posted: 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.
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 |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Zren
![](http://compsci.ca/v3/uploads/user_avatars/1110053965512db6185954b.png)
|
Posted: 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
|
|
|
|
|
|
![](images/spacer.gif) |
TerranceN
|
Posted: 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... |
|
|
|
|
![](images/spacer.gif) |
ProgrammingFun
![](http://compsci.ca/v3/uploads/user_avatars/11682880074bcb590d30b0a.png)
|
Posted: Wed Jan 13, 2010 7:54 am Post subject: RE:Getch Command Confusion |
|
|
Thanks! This should make my life easier. |
|
|
|
|
![](images/spacer.gif) |
|
|