Largest String, Extra new line char


in my code i wonder that after using cin.get() to handle extra newline char after entering the size why i am able to input only 2 strings for input size to be 3???1!!!

You have entered a ’ ’ (space) after 3, removing the space after 3 fixes this error. cin.get() was consuming the space and not the ‘\n’ .
Tip : You can use std::string class provided in C++ STL to avoid such issues.
@akb.tech17

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.