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

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




PostPosted: Mon Jan 23, 2006 4:35 pm   Post subject: Getch

Hey. I want to do one of those commands that when you say "Press any key to continue.", the user presses whatever key and it moves them up to the next step to the program. I forget how to do it, but i know getchs are involved. Help me plz Smile
Sponsor
Sponsor
Sponsor
sponsor
Rasta Fella




PostPosted: Mon Jan 23, 2006 4:53 pm   Post subject: (No subject)

You can also use this command Input.Pause It justs waits fo a user to input a key.
blaster009




PostPosted: Mon Jan 23, 2006 5:15 pm   Post subject: (No subject)

But don't say "Any key". Input.Pause doesn't accept certain keys (Control for example). My teacher, who prides himself in looking for ways to make my programs fail (because I have a 96 in the class, I suppose) made sure to take away marks because I said "Any key" and Input.Pause failed to recognize the Page Up button.
Rasta Fella




PostPosted: Mon Jan 23, 2006 5:24 pm   Post subject: (No subject)

blaster009 wrote:
But don't say "Any key". Input.Pause doesn't accept certain keys (Control for example). My teacher, who prides himself in looking for ways to make my programs fail (because I have a 96 in the class, I suppose) made sure to take away marks because I said "Any key" and Input.Pause failed to recognize the Page Up button.


Yeah, actually alot of keys dont work when you use Input.Pause(page up, page down, end, insert etc.) But that's the only command I of my knowledge know that can be used for (press any key). But in general alot of keys on the keyboard work in accordance to this. If there is another method which can make you literally "press any key to continue" I would like to know for further reference.
person




PostPosted: Mon Jan 23, 2006 6:26 pm   Post subject: (No subject)

Beast wrote:
Hey. I want to do one of those commands that when you say "Press any key to continue.", the user presses whatever key and it moves them up to the next step to the program. I forget how to do it, but i know getchs are involved. Help me plz


code:

var a : string (1)
getch (a)
Beast_




PostPosted: Mon Jan 23, 2006 7:50 pm   Post subject: (No subject)

He is right. I remember my programming teacher teaching us that stuff way back. She set it up like this:

code:
var stop : string (1)
put "Press any key to continue."..
getch (stop)
cls



To my knowledge, that is the most efficient way of doing a user-triggered continuation of a program, if you ever want it to clear the screen, to make your program look neater. Smile
Delos




PostPosted: Mon Jan 23, 2006 8:51 pm   Post subject: (No subject)

Efficient, perhaps. Stable? No - so very simply crashed. Laughing
Clayton




PostPosted: Tue Jan 24, 2006 2:03 am   Post subject: (No subject)

how did this crash
code:

var a:string(1)
getch(a)
cls

??????????
its never crashed for me
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Tue Jan 24, 2006 10:21 am   Post subject: (No subject)

Ah yes...well, since no one has ever mentioned this bug in Turing before, I'll keep it to myself for a while longer. It's not important, since I only know about 2 other people who are privvy to this knowledge...
In other words, the getch() method is, for all intents and purposes, good.
person




PostPosted: Tue Jan 24, 2006 5:14 pm   Post subject: (No subject)

it doesnt crash for me
Clayton




PostPosted: Wed Jan 25, 2006 2:56 pm   Post subject: (No subject)

Rasta Fella wrote:
blaster009 wrote:
But don't say "Any key". Input.Pause doesn't accept certain keys (Control for example). My teacher, who prides himself in looking for ways to make my programs fail (because I have a 96 in the class, I suppose) made sure to take away marks because I said "Any key" and Input.Pause failed to recognize the Page Up button.


Yeah, actually alot of keys dont work when you use Input.Pause(page up, page down, end, insert etc.) But that's the only command I of my knowledge know that can be used for (press any key). But in general alot of keys on the keyboard work in accordance to this. If there is another method which can make you literally "press any key to continue" I would like to know for further reference.

use the hasch command, in this case it would be used in a loop
code:

loop
exit when hasch
end loop

this way the loop will end whenever the program detects a character
(hasch means has character) you can try that
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: