Remember
Register
1
new
Chill
new
Puzzles
new
GK
new
Sports
new
Business
Home
Questions
MCQs
Unanswered
Tags
Users
Ask a Question
Write Article
Articles
Connect to us
Related Articles
Optimising C++ Streams - cin, cout , cerr and clog
Difference between cin, cin.get(), cin.getline() in C++?
+1
vote
323
views
Difference between cin, cin.get(), cin.getline() in C++?
c++
posted
Jun 2, 2016
by
anonymous
Looking for an answer? Promote on:
There are an equivalent number of advantages and drawbacks, and -essentially- all depends on what you are reading: get() leaves the delimiter in the queue thus letting you able to consider it as part of the next input. getline() discards it, so the next input will be just after it.
If you are talking about the newline character from a console input,it makes perfectly sense to discard it, but if we consider an input from a file, you can use as "delimiter" the beginning of the next field.
Your comment on this post:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
Your answer
Preview
Email me at this address if my answer is selected or commented on:
Email me if my answer is selected or commented on
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please
log in
or
register
.
Similar Questions
+1
vote
PHP: What is the difference between Exception::getMessage and Exception::getLine ?
+1
vote
What is the difference between c and c++ in terms of design?
+3
votes
What is the difference between int and char in C?
+2
votes
What is the difference between upcasting and downcasting in C++?
...