| delorie.com/archives/browse.cgi | search |
| Message-ID: | <37921554.5975862E@pacificnet.net> |
| Date: | Sun, 18 Jul 1999 10:56:36 -0700 |
| From: | Ralph Gesler <rgesler AT pacificnet DOT net> |
| X-Mailer: | Mozilla 4.5 [en] (Win95; U) |
| X-Accept-Language: | en,ja |
| MIME-Version: | 1.0 |
| To: | djgpp AT delorie DOT com |
| Subject: | Re: cout with double number |
| References: | <7mo06p$gj2$1 AT wanadoo DOT fr> |
| Reply-To: | djgpp AT delorie DOT com |
gb wrote:
>
> hello
>
> i wrote the program:
> .....
> double pi= 3.14159265358979;
> ....
> { cout << pi; }
>
> in the screen : 3.14159
>
> a) Where are the other digits ?
> Someone told me to put "cout.width(number);" before each cout instruction,
> but it doesn't work .....
>
> b) Does "long double pi= 3.14159265358979;" exist with djgpp ?
>
The member function .width(number) defines output field width not
precision. Use .precision(number) to define number of digits after the
decimal point.
Ralph
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |