Computer Science Canada

Enter & r keypress

Author:  Punde [ Sat Feb 22, 2003 6:09 am ]
Post subject:  Enter & r keypress

Hello,
I want to add to my program a line that says "Press r to rerun enter to continue" I have tried everything and got the r part but not the enter part. I want ONLY r to rerun and ONLY when the user presses Enter the program will continue. Any help with this??? Thx.

[EDIT]
I have another problem Sad
I want to make this flag program that displays 5 flags coming from the top going downwards and stopping before they reach the end of the window. I want to do this using a module by making a procedure and calling them on the main program ( I know how to do this part). Can anyone help me with the flag going downwards part??? Thx again.

Author:  Tony [ Sat Feb 22, 2003 10:14 am ]
Post subject: 

ASCII value for r is 114 and for "Enter" its 10.

code:

var c:string(1)
getch(c)
put ord(c)

will tell you the ascii value of any key.

About flags going down, just redraw the picture a bit lower... so put that inside a forloop.

Author:  Punde [ Sat Feb 22, 2003 12:43 pm ]
Post subject: 

I got the flags now, but I still don't know how to do the Enter and R keypress. Can anyone tell me how??

Author:  Tony [ Sat Feb 22, 2003 2:22 pm ]
Post subject: 

i told you, ASCII values for r is 114 and "enter" is 10. Doesn't anyone read Evil or Very Mad ?

so
code:

var c:string(1)
getch(c)
if c=chr(114) then
put "you pressed r"
elsif c=chr(10) then
put "you pressed enter"
end if

Author:  Dan [ Sun Feb 23, 2003 2:37 pm ]
Post subject: 

if you still need more help look at this post:

http://danco.no-ip.com/turing/viewtopic.php?t=285

it is so close to being the same question it is funny, odd how that is, eh?


: