English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Okay I want to make a program similar to Pong (c) and I don't know what you could put for like the equivalent to if u hit the up arrow / down arrow... the only thing i know that has to do with hitting keyboard buttons is "kbhit()", which if anything is hit, but what would be for up/down arrow hit?

2006-11-18 12:46:18 · 3 answers · asked by YahooAnswers 2 in Computers & Internet Programming & Design

I had thought of that, but a cin would accept up and down.

2006-11-18 13:18:10 · update #1

Oh wait, how would you do that .. (say up = int for up arrow and down = down arrow)
a cout then
if(kbhit())
......?

2006-11-18 13:24:20 · update #2

3 answers

I remember trying to do learn the same thing during my second year college project. I don't remember the codes exactly, but here's a way of knowing it.

Just like writing a small program to accept an integer from the user and printing it on screen, write a mini program to wait on kbhit() function and print the value the function returns which is the value that is emitted whenever a particular key is hit. Now press the UP and DOWN key and you will know the codes. I guess it returns an integer.

Simple, ain't it?
--------------------------
I guess I used getch(), so that the navigation characters do not echo onto the screen. Since the codes are int (2bytes) I had to call the getch() twice for each key.

2006-11-18 13:14:14 · answer #1 · answered by swami060 3 · 0 0

I had an huge quantity of fluids even as i replaced into contained in the medical institution. I had in many cases soups, juice, and water the first day and moved on to soup, jello, and crackers until eventually I felt waiting to have a sandwich. The nurses informed me to commence ordinary so as that i do not disillusioned my abdomen with gas or constipation. I had no difficulty having a bowel circulation or passing gas even as i replaced into there. I also walked as a lot as i might want to so as which could have helped flow issues alongside. save hydrated to soften stools. the most suitable ingredient you want today might want to be to ought to rigidity even as going to the rest room.

2016-11-29 06:29:02 · answer #2 · answered by ? 4 · 0 0

Try the function getch described here http://www.delorie.com/djgpp/doc/libc/ and examine the result character to determine if a key has been pressed.

2006-11-18 13:17:53 · answer #3 · answered by F.G. 5 · 0 0

fedest.com, questions and answers