Computer Science, asked by Priyanka422, 1 year ago

Differentiate get( ) and getline( ) function?

Plz answer I will mark as brainliest ...☺❤

Answers

Answered by kunal8484
11
The getline() function reads a whole line, and using the newline character transmitted by the Enter key to mark the end of input. The get()function is much like getline() but rather than read and discard the newline character, get()leaves that character in the input queue.

The book(C++ Primer Plus) that I am reading is suggesting using get() over getline(). My confusion is that isn't getline() safer than get()since it makes sure to end line with '\n'. On the other hand, get() will just hangs the character in the input queue, thus potentially causing problem


this is the answer of your question please mark me brainleist please please please please please please please please please please please please please please please please please please please please please please please
Similar questions