Author Topic: Need Help with C++  (Read 313 times)

Ok I'm making a program in c++ and I'm getting stuck on one part.

Code: [Select]
cout << "Title: ";
getline(cin, title);
cout << endl << "Price:";
cin >> price;

It shows both of the cout at the same time and then it only takes the cin for price. Can anyone help me out with this?

What's the rest of the code?

I tried;
Quote
#include <iostream>

using namespace std;

int main()
{
    string name;
    int price;
    cout << "name: ";
    getline(cin, name);
    cout << endl << "Price:";
    cin >> price;
    cout << name << " " << price;
    return 0;
}

Got this;
Quote
name: test

Price:123
test 123
Process returned 0 (0x0)   execution time : 3.329 s
Press any key to continue.