| | |
Help. This is a strange problem
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
•
•
Originally Posted by Narue
>Another way to purge all those wobbly '\n' ...
That example is incompete, which is why cin.ignore is a superior alternative. It forces you to provide all of the requisite information whereas with the loop approach it's easy to miss a very important test for end-of-file. The correct loop would be:
Or using the C-style alternative:C++ Syntax (Toggle Plain Text)
while (std::cin.get(ch) && ch != '\n') ;
C++ Syntax (Toggle Plain Text)
while ((ch = std::cin.get()) != EOF && ch != '\n') ;
May 'the Google' be with you!
![]() |
Similar Threads
- whoa... very strange problem.. you will want to read this.. (Viruses, Spyware and other Nasties)
- strange problem - cookies on desktop (Windows NT / 2000 / XP)
- strange keyboard/mouse problem (USB Devices and other Peripherals)
- Rather strange problem copying, need assistance. (Perl)
- Very Strange Word 2003 Problem (Windows Software)
- Strange keyboard & highliting problem. (USB Devices and other Peripherals)
- A strange problem: unplugged network cable !! (Networking Hardware Configuration)
- strange problem (C)
- HELP!!! very strange problem! (Troubleshooting Dead Machines)
Other Threads in the C++ Forum
- Previous Thread: need to run these programs
- Next Thread: PLEASE help with project - compile error
| Thread Tools | Search this Thread |
api array arrays based beginner binary bitmap c++ c/c++ calculator char char* class classes code coding compile compiler console conversion convert count data database delete deploy developer dll download dynamiccharacterarray email encryption error file forms fstream function functions game generator getline givemetehcodez graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template text text-file tree url variable vector video visual visualstudio win32 windows winsock word wordfrequency wxwidgets






