新手求教sstream
为什么会多出一行空行 运行结果不对
#if 1
#include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main ()
{
string mystr;
float price=0;
int quantity=0;
cout << "Enter quantity: ";
getline (cin,mystr);
stringstream(mystr) >> quantity;
cout << "Enter price: ";
getline (cin,mystr);
stringstream(mystr) >> price;
cout << "Total price: " << quantity*price << endl;
return 0;
}
#endif