About the video lecture of reading a list of strings

why do we have written cin.get() before the for loop

Hi @aslesha.j7

cin.get() is used to flush or remove the data in buffer stream of cin. It is used when we need to read a string as input after we have used cin to take a number as input. So it is used between that number’s input and string input.

Hope it Helps.

why it is necessary only in case of string inputs?

Hi @aslesha.j7
Because strings take as input the whole buffered stream data and there are high possible chances that our string might take in some garbage value as input.

Hope it Helps.

okay thank you @nayansachdeva