To avoid extra string input

Why have we used cin.get() to avoid \n? How does this work

the difference between the normal cin with these >>
and cin.get() is that cin>>s will terminate when a whitespace is found but the same will not happen with cin.get() . it will take that also into consideration .