what is wrong in the code?
Redundant Parentheses
Hello @17manishms
Change getline(cin, str) to cin >> str;
The difference
cin reads a word while getline will read a line
When you take the number n as input, the endline character after the number is still in the buffer which getline takes as input while cin will look for a word.
Let me know if you still need any help.
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.