I'm using visual studio .net c++ and I'm looking for the easiest code to drop the 0 on 0.233 to .233 when displaying floating point variable on screen. Thanks.
dallin
0
Newbie Poster
Recommended Answers
Jump to PostMy first question is: why bother? Unless there's a trick that's slipped my mind, you need to copy the value into a string and then remove the first character:
#include <iostream> #include <sstream> using namespace std; int main() { double f = 0.123; ostringstream sout; sout<< f; …
All 3 Replies
Reply to this topic
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.