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
Post a Comment