Why it's not printing? | Sololearn: Learn to code for FREE!


Why it's not printing?

https://code.sololearn.com/cUS3aXlJw8O1/?ref=app In this code ,We basically have to enter - string int string But when I'm trying to print 3rd string,It's not printing,But why?


5/24/2022 2:00:18 PM

Manav Roy

2 Answers

New Answer


Use cin.ignore() after the last cin and before getline. The issue is that there is a character left in the stream which prevents reading the last string: https://stackoverflow.com/questions/12691316/getline-does-not-work-if-used-after-some-inputs#12691486


Lisa Thank you very much ☺️☺️