cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
cin.ignore()
cin.ignore()
Dec 1, 2013 at 11:54pm UTC
thiskid
(48)
Hello, I am trying to avoid using the cin.ignore() function. How would I write a line(s) that does the same purpose as cin.ignore()? I know what the cin.ignore() command does but I am just trying to think of an alternative way to write it.
Thanks for any help.
Dec 2, 2013 at 12:02am UTC
long double main
(999)
cin.get()
, maybe?
http://www.cplusplus.com/reference/istream/istream/get/
Dec 2, 2013 at 2:47am UTC
Duthomhas
(13116)
But get() doesn't necessarily do the right thing.
The best way is to put it all in a single routine, which you call to obtain input. For example:
http://www.cplusplus.com/forum/beginner/13044/#msg62827
(These days you can get rid of the word "mutable" on line 10.)
Enjoy!
Topic archived. No new replies allowed.