Cin.getline( ) why we use it

please tell more about cin.getline( )
why you use it and if i doesn’t use it i am not able to take 5 strings from user why???

cin.getline() is used to take a whole line as a input

cin takes input till it encounter a whitespace(space,newline)

cin.getline() takes input till it encounter a newline

Reference Code

if you have doubt
feel free to ask

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.