basic question about getting input

I can't understand why the code segment below isn't working properly. After I input a price (say 18.70), the program outputs "What is the name of this product?What is the score of this product?" as if it just ignores the getline(cin, c) command. Why does this happen? Thanks!

int a;
double b;
string c;

cout<<"What is the price of this product?";

cout<<"What is the name of this product?";
getline(cin, c);

cout<<"What is the score of this product?";
Why are you using getline(cin, c);

Just use another cin statement like this:

cin >> c;

Or maybe try changing the string type to char
I'm using getline because the input might have spaces in it (I might want to enter "Buzz lightyear doll" or something), so I want to pick up the entire string.
Topic archived. No new replies allowed.