Doubt with cin.get()

as cin.get() doesnt consumes “\n” character in input.
so for the folowing code https://ide.codingblocks.com/s/249004
,p1 should not be input in any case since cin.get() will always encounter “\n” and leave it in buffer.
but its not the case , can u pls explain why?

@aman17nov1999 you are taking input in line 6, it will take the ‘\n’ character present in the buffer, and p1 will be able to take input for the next line.

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.