![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#21 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Getch would be no better. One shouldn't mix the two types of streams unless one has synched THEM. If they were synched, the newline would still mess up getch unless you called "rewind (stdin)." cin.sync () will do it, as Mitakeet says -- it slams the get pointer back to the beginning of the buffer (the "put" location for the read mechanism), thus discarding any characters in the buffer. I consider it more effective than "ignore".
__________________
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 |
|
|
|
|
|
#22 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5
![]() |
Thnx for the clarification.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for." -- Socrates |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|