Please check the code and tell me where i am wrong
Just use cin for input. Then it will work fine.
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.
but while using string getline() should also work fine.
why it is so that cin work not getline().
If you want to use getline() then write cin.ignore() before taking inputs. it will clear input buffer.
1 Like