Okay, when I do this it works:
--------------------
string mystr;
float cost=0;
int quantity=0;
cout << "\nEnter Cost: ";
getline (cin,mystr);
stringstream(mystr) >> cost;
cout << "\nEnter Quantity: ";
getline (cin,mystr);
stringstream(mystr) >> quantity;
cout << "\nTotal Cost: " << cost*quantity << endl;
--------------------
However, when I add it to the rest of the program, it skips the user input for cost and goes straight to quantity. I have tried taking each part out seperately to see what was doing it, but it did it regardless - only working when it is alone like above.
------------
{
cout << "First line\n";// The (\) doesn't show up
cout << "Second line\n" << "Third line\nFourth line" << endl; // "endl" and "\n" are *essentially* the same
int p;
float i, r;
cout << "\nTo calculate simple one-year interest, please enter initial amount: ";
cin >> p;
cout << "\nAnd the interest rate (in decimal form): ";
cin >> r;
i = p*r;
cout << "The interest of " << p << " at the rate of " << r << " is " << i <<".\n\n";
//Using "\n" twice doubles its function.
int a;
cout << "Bloodninja: Age? " << "\nYou: ";
cin >> a;
cout << "Bloodninja: Perfect..." << "\nYou: Why?" << "\nBloodninja: I put on my wizard hat and cloak." << endl;
cout << "You: Oh god not again!" << endl;