![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 | |
|
Professional Programmer
|
Input - pressing enter
I just need to know of a simple way to get a user input but without them having to press enter after they give their answer.. so if the answer to question "a" was "1", the person would only have to press "1" and that would act like it entered 1, then pressed enter..
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ |
|
|
|
|
|
|
#2 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
This is not possible with standard C/C++. You must use non-portable code. The code you use depends upon your operating system and platform, which is why the posting guidelines recommend including that information with your questions.
There is not a portable way because there is not a world standard way of getting input and producing output. Some people are blind, some are paralyzed, some have home-built systems, some systems have no UI per se. You get the picture.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: May 2005
Location: ma
Posts: 138
Rep Power: 4
![]() |
what is wrong with hitting enter? If the user accidently hit 2 when they meant to hit 1 in your method they'd get the question wrong unfairly. But by having to hit enter they'd have the chance go back and correct their mistake. Im just curious why you need the input immediately. good luck.
|
|
|
|
|
|
#4 | |
|
Professional Programmer
|
It's not that i need it, its because im making a game and there is a shop to buy items at, i just want to name the items on the screen on a list in numbers so 1. shoes, 2. shirt.. ect. But after selecting the item it will ask "do you really want to purchase this item" or something along those lines, having to press enter just makes it more work i guess, its just one of those little things that i want to change in the game. Its not really needed though so ill do without it until i decide enter is really pissing me off.
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ |
|
|
|
|
|
|
#5 |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
And another thing: what if you have a number higher than 9?
![]() |
|
|
|
|
|
#6 | |
|
Professional Programmer
|
ah... never thought of that :eek:
__________________
▄▄▄▄ Quote:
Due to incorrect calculations during the middle ages, our calendar actually begins a few years after Jesus' birth. Thus the real 6/6/6 happened a few years back. The world already ended and you missed it. Download Code::Blocks now! ▄▄▄▄ |
|
|
|
|
|
|
#7 |
|
Hobbyist Programmer
Join Date: May 2005
Location: ma
Posts: 138
Rep Power: 4
![]() |
well you could do a.) item, b.) item, etc. That would give you 16 more single digit possibilities.
|
|
|
|
|
|
#8 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Along those lines, you could also have the choices, !, @, #, $, %, etc., and have even MORE single-character possibilites.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#9 | |
|
Expert Programmer
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4
![]() |
Quote:
. |
|
|
|
|
|
|
#10 |
|
Hobbyist Programmer
|
...
1: Shoes 2: Shirt 3: Weapons @: Pants ¿: Hat :p |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|