devxlogo

Converting a Number to a String

Converting a Number to a String

The standard strstream family of classes enables you to convert numeric values into their string representation easily. You need to instantiate an strstream object, insert the numeric value to it using the overloaded #include #include using namespace std;int main(){ ostrstream s; float f = 6.6777; s

Note that strstream overload to int main(){ ostrstream s; void *p = &s; // take address of s s

devx-admin

Share the Post: