Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How do I format a double???

0 views
Skip to first unread message

Dadi

unread,
Apr 27, 1999, 3:00:00 AM4/27/99
to
Hi, I know this is a pretty stupid question but how do I format a double
number to my liking. I.e. cutting zeros off at the back and so on?

Thanks in advance.

Kristopher Krug

unread,
Apr 27, 1999, 3:00:00 AM4/27/99
to
ÿþ< ! D O C T Y P E H T M L P U B L I C " - / / W 3 C / / D T D W 3 H T M L / / E N " > < H T M L > < H E A D > < S T Y L E > < / S T Y L E > < M E T A c o n t e n t = ' " M S H T M L 5 . 0 0 . 0 9 1 0 . 1 3 0 9 " ' n a m e = G E N E R A T O R > < M E T A c o n t e n t = " t e x t / h t m l ; c h a r s e t = u n i c o d e " h t t p - e q u i v = C o n t e n t - T y p e > < / H E A D > < / H T M L > < H T M L > < H E A D > < / H E A D > < B O D Y > < D I V > D e p e n d i n g o n i f y o u ' r e u s i n g M F C : < / D I V > < D I V > & n b s p ; < / D I V > < D I V > d o u b l e d b l N u m = 1 0 9 . 0 0 7 0 0 ; < / D I V > < D I V > & n b s p ; < / D I V > < D I V > / / m i n i m u n m o f 6 p l a c e s o u t p u t ( n o t e : r e s u l t i s n e v e r t r u n c a t e d i f l o n g e r ) , 2 d i g i t s a f t e r t h e d e c i m a l p l a c e < / D I V > < D I V > C S t r i n g s t r T e m p ; < / D I V > < D I V > s t r T e m p ( & q u o t ; % 6 . 2 f & q u o t ; , d b l N u m ) ; < / D I V > < D I V > & n b s p ; < / D I V > < D I V > T h e s y n t a x h e r e i s t h e s a m e a s t h e s p r i n t f f a m i l y o f f o r m a t w i d t h a n d s p e c i f i e r s , s e e M S D N , t o p i c & q u o t ; < F O N T f a c e = T a h o m a s i z e = 2 > F o r m a t S p e c i f i c a t i o n F i e l d s : p r i n t f a n d w p r i n t f F u n c t i o n s < / F O N T > & q u o t ; , o r < / D I V > < D I V > & n b s p ; < / D I V > < D I V > < B > % < / B > [ < A h r e f = " m k : @ M S I T S t o r e : f : \ M i c r o s o f t % 2 0 V i s u a l % 2 0 S t u d i o \ M S D N 9 8 \ 9 8 V S \ 1 0 3 3 \ v c c o r e . c h m : : / h t m l / _ c r t _ f l a g _ d i r e c t i v e s . h t m " > f l a g s < / A > ] [ < A h r e f = " m k : @ M S I T S t o r e : f : \ M i c r o s o f t % 2 0 V i s u a l % 2 0 S t u d i o \ M S D N 9 8 \ 9 8 V S \ 1 0 3 3 \ v c c o r e . c h m : : / h t m l / _ c r t _ p r i n t f _ w i d t h _ s p e c i f i c a t i o n . h t m " > w i d t h < / A > ] [ < B > . < / B > < A h r e f = " m k : @ M S I T S t o r e : f : \ M i c r o s o f t % 2 0 V i s u a l % 2 0 S t u d i o \ M S D N 9 8 \ 9 8 V S \ 1 0 3 3 \ v c c o r e . c h m : : / h t m l / _ c r t _ p r e c i s i o n _ s p e c i f i c a t i o n . h t m " > p r e c i s i o n < / A > ] [ { < B > h < / B > | < B > l < / B > | < B > I 6 4 < / B > | < B > L < / B > } ] < A h r e f = " m k : @ M S I T S t o r e : f : \ M i c r o s o f t % 2 0 V i s u a l % 2 0 S t u d i o \ M S D N 9 8 \ 9 8 V S \ 1 0 3 3 \ v c c o r e . c h m : : / h t m l / _ c r t _ p r i n t f _ t y p e _ f i e l d _ c h a r a c t e r s . h t m " > t y p e < / A > < / D I V > < D I V > & n b s p ; < / D I V > < D I V > - ( m i n u s ) w i l l l e f t a l i g n t h e r e s u l t ( f l a g ) < / D I V > < D I V > < F O N T f a c e = T a h o m a s i z e = 2 > + ( p l u s ) w i l l i n c l u d e t h e s i g n o f t h e r e s u l t < / F O N T > < / D I V > < D I V > 0 ( z e r o ) w i l l p a d d w i t h z e r o e s t h e m i n i m u m w i d t h < / D I V > < D I V > & n b s p ; < / D I V > < D I V > < F O N T f a c e = T a h o m a s i z e = 2 > T h e w i d t h a n d p r e c o i s i o n a r e o p t i o n a l a n d s p e c i f y t h e m i n i m u m w i d t h a n d n u m b e r o f s i g n i f i c a n t d i g i t s a f t e r t h e d e c i m a l p l a c e . S e e t h e d o c u m e n t a t i o n f r m o r e d e t a i l s . < / F O N T > < / D I V > < / B O D Y > < / H T M L >

David Lowndes

unread,
Apr 28, 1999, 3:00:00 AM4/28/99
to
>Hi, I know this is a pretty stupid question but how do I format a double
>number to my liking. I.e. cutting zeros off at the back and so on?

sprintf? Have a look at "Format Specification Fields: printf and
wprintf Functions" in your VC++ help.

Dave
----
My address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow-up email copies.

0 new messages