Re: Formatting numbers
From: Al Bowers (xal_at_abowers.combase.com)
Date: 10/07/03
- Next message: Jack Klein: "Re: Formatting numbers"
- Previous message: Alan Connor: "Re: Why Use anything BUT C?"
- In reply to: Jack Klein: "Re: Formatting numbers"
- Next in thread: Jack Klein: "Re: Formatting numbers"
- Reply: Jack Klein: "Re: Formatting numbers"
- Reply: CBFalconer: "Re: Formatting numbers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 06 Oct 2003 22:41:50 -0400
Jack Klein wrote:
> On Tue, 07 Oct 2003 01:48:13 GMT, "Christopher Robin"
> <anonyngaddr@hotmail.com> wrote in comp.lang.c:
>
>
>>Hi,
>>
>>I'm trying to find if a function exists that would format a large (> 1000)
>>number with comma notation on a unix type system...
>>
>>I currently have
>>X = 10000;
>>
>>printf("X = %d\n", X);
>>which obviously only prints:
>>X = 10000
>>
>>I'd like it if I could find a function that would format it properly so it
>>would print:
>>
>>X = 10,000
>>
>
> Note that it doesn't really take a function, just a change in the call
> to printf:
>
> printf("X = %d,%d\n", X/1000, X%1000);
>
That would print: 10,0
ITYM printf("X = %d,%03d\n",X/1000, X%1000);
-- Al Bowers Tampa, Fl USA mailto: xal@abowers.combase.com (remove the x) http://www.geocities.com/abowers822/
- Next message: Jack Klein: "Re: Formatting numbers"
- Previous message: Alan Connor: "Re: Why Use anything BUT C?"
- In reply to: Jack Klein: "Re: Formatting numbers"
- Next in thread: Jack Klein: "Re: Formatting numbers"
- Reply: Jack Klein: "Re: Formatting numbers"
- Reply: CBFalconer: "Re: Formatting numbers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|