c++ - User inputs stringstream, then need convert to string to pass in function parameters -


i trying ask user stringstream, convert string can pass in functions parameters. how can ? :

string nm; stringstream ss; cout << " please enter charge made " << endl;                  cin >> nm;                  ss.str();                  cca.docharge(nm); 

are asking pass actual stream function, or string? following passes stream:

std::string str; std::stringstream ss;  std::getline(std::cin, str); ss.str( str );  cca.docharge(ss); 

this passes string:

cca.docharge(str); 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -