In this program,sir use cin.get(); after taking int n as input.And sir said that it is to consume extra enters .I don’t understand this .In input buffer user only input data for int n ,so why this cin.get(); is used there?
Reading a list of string
The user presses an enter after inputting the data.
That enter has to be taken care of, else it gets registered as the input for next input.
But in case of multiple integer type variable we don’t use cin.get() .\n has some ASCII value then this ASCII value is going to store in next integer variable .But actually it is not store why?
This is only the issue when we use cin.getline(), normal cin will ignore the newline.
In this code we are using cin.getlin() for input, therefore it is required.