Fatihul Ulum Community of Knowledge
Would you like to react to this message? Create an account in a few clicks or log in to continue.

string streams

Go down

string streams Empty string streams

Post  andy maulana Sun Mar 15, 2009 12:31 am

#include <iostream>
#include <string>
#include <sstream>
using namespace std;

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

cout << "tulis angka atau huruf: ";
getline (cin,mystr);
stringstream(mystr) >> price;
cout << "tulis yang ingin anda masukkan: ";
getline (cin,mystr);
stringstream(mystr) >> quantity;
cout << "jumlah: " << price*quantity << endl;
return 0;
}
andy maulana
andy maulana
Pejuang
Pejuang

Jumlah posting : 74
Age : 33
Lokasi : jawa timur
Registration date : 13.02.09

Kembali Ke Atas Go down

Kembali Ke Atas


 
Permissions in this forum:
Anda tidak dapat menjawab topik