www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/11/16:38:07

From: Stephen Snape <stephen DOT snape AT virgin DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Float question...
Date: Sun, 11 Oct 1998 21:30:48 +0000
Organization: Virgin News Service
Lines: 21
Message-ID: <36212386.147A4F5B@virgin.net>
References: <3620BFD1 DOT 32265FF4 AT netrover DOT com>
NNTP-Posting-Host: 194.168.70.41
Mime-Version: 1.0
X-Mailer: Mozilla 4.04 [en] (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


Nicolas Blais wrote:

> Let's say I do this: const float version_of_game = 1.1;
> When I do this : cprintf("The version: %f\n\r", version_of_game);
>
> Why will it print 1.10000, when I just want it to print 1.1?
>
> Thanks, Nicolas Blais


Because it does. Try :

cprintf("The version %1.1f",version_of_game);

The .1 signifies that you only want to use 1 decimal place, or however
many you want.

Steve.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019