I have searched the forum , also over internet but i didn't found any understandable method to convert float number to string , Please help Me in conversion.
Majestics
84
Posting Pro
Recommended Answers
Jump to Postlook up stringstream. However, note that some floats cannot be completely represented by a stream. Therefore, only a "limited" number of digits will appear in the decimal portion of the string. Consider the float representation of 1/3. I'ts 0.3333... where 3 goes on indefinitely. When converted to a string the …
Jump to PostYou can use ostringstream from <sstream>, i use that, although it may not be the easyest way.
#include <sstream> std::string Convert (float number){ std::ostringstream buff; buff<<number; return buff.str(); }
ostringstream and istringstream are basically the same as cout and cin, but they don't print stuff on screen. …
All 7 Replies
Lerner
582
Nearly a Posting Maven
Sci@phy
97
Posting Whiz in Training
TheBeast32
54
Posting Whiz in Training
vmanes
1,165
Posting Virtuoso
Narue
5,707
Bad Cop
Team Colleague
vmanes
1,165
Posting Virtuoso
stilllearning
148
Posting Whiz
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.