Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 10th, 2005, 9:24 AM   #1
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
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:
Originally Posted by Mohamed Jihad
Durka durka!
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!
jayme is offline   Reply With Quote
Old Dec 10th, 2005, 10:09 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Dec 10th, 2005, 10:36 AM   #3
linuxpimp20
Hobbyist Programmer
 
Join Date: May 2005
Location: ma
Posts: 130
Rep Power: 4 linuxpimp20 is on a distinguished road
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.
linuxpimp20 is offline   Reply With Quote
Old Dec 10th, 2005, 11:14 AM   #4
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
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:
Originally Posted by Mohamed Jihad
Durka durka!
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!
jayme is offline   Reply With Quote
Old Dec 10th, 2005, 12:14 PM   #5
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
And another thing: what if you have a number higher than 9?
Polyphemus_ is offline   Reply With Quote
Old Dec 10th, 2005, 12:15 PM   #6
jayme
Professional Programmer
 
jayme's Avatar
 
Join Date: Nov 2005
Location: Canada
Posts: 495
Rep Power: 0 jayme is an unknown quantity at this point
Send a message via MSN to jayme
ah... never thought of that :eek:
__________________

Quote:
Originally Posted by Mohamed Jihad
Durka durka!
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!
jayme is offline   Reply With Quote
Old Dec 10th, 2005, 12:22 PM   #7
linuxpimp20
Hobbyist Programmer
 
Join Date: May 2005
Location: ma
Posts: 130
Rep Power: 4 linuxpimp20 is on a distinguished road
well you could do a.) item, b.) item, etc. That would give you 16 more single digit possibilities.
linuxpimp20 is offline   Reply With Quote
Old Dec 10th, 2005, 2:36 PM   #8
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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
DaWei is offline   Reply With Quote
Old Dec 10th, 2005, 2:41 PM   #9
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 4 Polyphemus_ is on a distinguished road
Quote:
Originally Posted by DaWei
Along those lines, you could also have the choices, !, @, #, $, %, etc., and have even MORE single-character possibilites.
Yeah... well... what shall I say.. looks pretty weird in my eyes, but it is a possibility .
Polyphemus_ is offline   Reply With Quote
Old Dec 10th, 2005, 2:44 PM   #10
UnKnown X
Hobbyist Programmer
 
UnKnown X's Avatar
 
Join Date: Dec 2005
Location: Sandvika, Norway
Posts: 114
Rep Power: 0 UnKnown X is an unknown quantity at this point
Send a message via MSN to UnKnown X
...

1: Shoes
2: Shirt
3: Weapons
@: Pants
¿: Hat



:p
UnKnown X is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:31 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC