|
|
|
Pentium
   
Group: Forum Members
Last Login: Today @ 17:24:57
Posts: 3,012,
Visits: 6,153
|
|
|
|
|
|
386
   
Group: Forum Members
Last Login: Today @ 11:35:47
Posts: 583,
Visits: 1,435
|
|
Look up kbhit() -- sets flag if a key has been pressed
getch() -- gets ascii value of key that has been hit.
Think about using the combo in a loop.
|
|
|
|
|
Pentium
   
Group: Forum Members
Last Login: Today @ 17:24:57
Posts: 3,012,
Visits: 6,153
|
|
thank you will look into them
-------------------------------------------------------------------
www.alex3410.com <- updated take a look (29/10/08)
CPU: core2duo E4300 1.8GHz (@2.6GHz), RAM: 2GB corsair XMS2, Gcard: Geforce 7900GS 256MB, Mboard:ASROCK4CoreDual-SATA2, HDD: 1 X 500GB 2X250GB, Monitor:19" acer widescreen

|
|
|
|
|
Pentium
   
Group: Forum Members
Last Login: Today @ 17:24:57
Posts: 3,012,
Visits: 6,153
|
|
i found a more elegant solution to the problem and just thought it might be useful for others
instead of trying to only let them enter a single char i let them enter what they want and read the first char then clear the input buffer removing the rest of the word
cin.clear();
cin.ignore( std::numeric_limits<
streamsize>::max(), '' );
that way they can enter
e,E,East & east and all 4 will cause east to be selected
-------------------------------------------------------------------
www.alex3410.com <- updated take a look (29/10/08)
CPU: core2duo E4300 1.8GHz (@2.6GHz), RAM: 2GB corsair XMS2, Gcard: Geforce 7900GS 256MB, Mboard:ASROCK4CoreDual-SATA2, HDD: 1 X 500GB 2X250GB, Monitor:19" acer widescreen

|
|
|
|
|
386
   
Group: Forum Members
Last Login: Today @ 11:35:47
Posts: 583,
Visits: 1,435
|
|
Glad to see you are thinking out of the box, and that you are not happy to be spoon-fed - what happens when they press 4 or $ or CTRL e by mistake, instead of e or E?
Sure as little eggs, users will do whatever you least expect -- sometimes I get confused on what is in standard C as compared to C++ but I'm sure you can TRY to find out how to handle exceptional cases
(EDIT - just realised what a weird expression I've used, whatever have little eggs got to do with it? Sometimes I wonder where these expressions come from -- alien influences!)
|
|
|
|
|
Pentium
   
Group: Forum Members
Last Login: Today @ 17:24:57
Posts: 3,012,
Visits: 6,153
|
|
|
|
|
|
386
   
Group: Forum Members
Last Login: Today @ 11:35:47
Posts: 583,
Visits: 1,435
|
|
They don't need to sit down and work out how and why the program works [Angry] + the fact i spend hours doing it and him handing that out has brought everyone else up to where i am at a fraction of the time and effort [Angry]
Don't let it bug you - they will ever remain carp programmers. I haven't yet met a programmer who managed to learn without doing! Mind you, I do share your anger at the lecturer for spoon feeding his group, obviously he is yet another one suffering under badly crafted metrics. Probably gets a pay cut if he can't tick the box to say students understand input streams.
|
|
|
|
|
Pentium
   
Group: Forum Members
Last Login: Today @ 16:58:03
Posts: 5,534,
Visits: 29,218
|
|
|
|
|