I am confuse about using cin; cin.getline() and gets_s. I understand that cin can be used to input all data types and cin.getline() is only for strings and gets_s is for struct.
But I am using cin to input a string now and it works perfectly, but how strange cin.getline doesn’t work although I use cin.ignore() (the output isn’t enough). Please help me to figure it out. Tks.
New contributor
An Nguyễn Khánh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2