Why my cide is running for only 2 input
@kailash_01 because you are using getline. try using cin and your code will run for all inputs. getline reads the character uptil “\n” thus it gets as a input in the next line.
http://www.cplusplus.com/reference/string/string/getline/
but in input there is no ‘\n’ charachter why it is going to next line???
There is something known as the delimiter , which is default set as ‘\n’.
You can read more about it on preference. Just google it.
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.