Could not understand why cin.get() was used to take the input of the integer value/
Could not understand cin.get()
Understood what you sent but could not find out why it was specifically used to input the integer in this video.
time stamp is 01:01 i am unable to understand why cin.get() was used to consume the extra space after \n as said by prateek bhaiya.
@ayusdas2000
So what happens is
after you cin>>n;
the next input in buffer is ‘\n’
if you then do getline(cin,string)
the string will end up storing ‘\n’
So we use cin.get() to consume ‘\n’ in input buffer before we can start taking string inputs