getline problems

I'm asking the user to input 4 values in this order:

int
int
int
and a string

The string the user enters is gonna be a whole sentence, so I decided to use getline(cin,string);

however, when I do this, the program will completely skip the option for the user to enter data, like it will ask "please enter a string:" and then skip the getline(cin,string); and go to the next statement

I think this is an issue with a new flag?

Ok I found the solution, I put cin.ignore() right before I did getline(cin,string);

Does the cin.ignore() like ignore the newline or something? Can someone explain why this works now?
Topic archived. No new replies allowed.