1. 1.
    0
    // stringstreams
    4. include <iostream>
    5. include <string>
    6. include <sstream>
    using namespace std;

    int main ()
    {
    string mystr;
    float price=0;
    int quantity=0;

    cout << "Enter price: ";
    getline (cin, mystr);
    stringstream(mystr) >> price;
    cout << "Enter quantity: ";
    getline (cin, mystr);
    stringstream(mystr) >> quantity;
    cout << "Total price: " << price*quantity << endl;
    return 0;
    }
    Enter price: 22.25
    Enter quantity: 7
    Total price: 155.75
    ···
   tümünü göster