#include #include #include using namespace std; int main(void) { ostringstream ostr; //output string string num; //count to 1000, putting the elements into the string for(int i=0; i<=1000; i++) ostr << i; //exctract the string num = ostr.str(); //how long is the string? cout << "Result is: " << num.length() << " characters long."; cout << "Result: " << num << endl; return 0; }