Cin.get(), function unable to understand

Why we are using cin.get()

is this okay?

int n;
cin >> n;
string s[100];

for(int i=0; i<n; i++){
	getline(cin,s[i]);
}
for(int i=0; i<n; i++){
	cout << s[i]<<endl;
}

@dileep9968 no its not try to run this code it takes one string less as input and shows endl in place of it.
if after input number we use cin.getline() then the enter after input no is considered as the first string so in order to prevent it cin.get() is used.
hope its clear if yes dont forget to hit like and mark resolved :smiley:

is it clear @dileep9968?

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.