In the following code, I'm trying to figure out why when I output the string "data" it's empty:
My book says the parameter to the stringstream constructor is a reference so write operations for stringstream objects act directly on the string object(e.g. data):Code:#include<iostream> #include<string> #include<sstream> using namespace std; int main() { string data; stringstream outString(data); int num = 50; outString<<num; cout<<data<<endl; return 0; }
stringstream outString(data);



LinkBack URL
About LinkBacks


