String sorting and access

in vdo 'string 02- sorting ’ why are we using cin.get(),
and why we are not using ci for taking string input instead of
getline

cin.getline() reads input up to ‘\n’ and stops

cin.get() reads input up to ‘\n’ and keeps ‘\n’ in the stream

we are using getline instead of cin . because cin would not consider any character entered after space, but getline accepts values until a \n is entered into input string

1 Like

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.