Cin.get() use after taking input of n

Why do we need to write this line “cin.get()” after taking input of n?

@Prakhar_Nagpal you use it to consume enter otherwise the program will be terminated as soon you hit enter.
if you dont want to use it use cin instead of getline.
i hope its cleared if yes dont forget to mark it as resolved and hit like :smiley: