Click here to Skip to main content
15,919,336 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: VS 7.1 On Windows XP Pin
Christian Graus27-Jan-05 14:17
protectorChristian Graus27-Jan-05 14:17 
GeneralRe: VS 7.1 On Windows XP Pin
Jim Crafton27-Jan-05 17:10
Jim Crafton27-Jan-05 17:10 
GeneralRe: VS 7.1 On Windows XP Pin
rbid27-Jan-05 23:57
rbid27-Jan-05 23:57 
GeneralRe: VS 7.1 On Windows XP Pin
Grahamfff28-Jan-05 9:50
Grahamfff28-Jan-05 9:50 
Generalconvert double to char Pin
Sam197927-Jan-05 10:42
Sam197927-Jan-05 10:42 
GeneralRe: convert double to char Pin
Chris Losinger27-Jan-05 11:03
professionalChris Losinger27-Jan-05 11:03 
GeneralRe: convert double to char Pin
Jim Crafton27-Jan-05 17:07
Jim Crafton27-Jan-05 17:07 
GeneralRe: convert double to char Pin
trelliot27-Jan-05 13:16
trelliot27-Jan-05 13:16 
I take it that you actually want to pad the the number with trailing 0's.
Here's 1 method:

// test.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <conio.h>

int _tmain(int argc, _TCHAR* argv[])
{
char buffer[64];
char Format[32];
double dNum = 99999999999.0;
int MaxPrecision = 5;
int Precision;
double Divisor = 10.0;

for(Precision = 0; Precision <= 5; Precision++)
{
sprintf(Format, "%%.%uf", Precision);

int CharCount = sprintf(buffer, Format, dNum);
if(CharCount >= 0)
{
int i;
if(!strchr(buffer, '.'))
{
buffer[CharCount] = '.';
CharCount++;
}
for(i = 0; i < MaxPrecision - Precision; i++)
buffer[CharCount + i] = '0';

buffer[CharCount + i] = 0;
}


printf("%s\n", buffer);

dNum = dNum + (9 / Divisor);
Divisor *= 10;

}
getch();
return 0;
}
GeneralRe: convert double to char Pin
trelliot27-Jan-05 17:20
trelliot27-Jan-05 17:20 
GeneralRe: convert double to char Pin
JKallen27-Jan-05 17:32
JKallen27-Jan-05 17:32 
GeneralRe: convert double to char Pin
Mircea Puiu29-Jan-05 5:16
Mircea Puiu29-Jan-05 5:16 
QuestionIs a directory on local PC? Pin
Neville Franks27-Jan-05 10:34
Neville Franks27-Jan-05 10:34 
AnswerRe: Is a directory on local PC? Pin
David Crow27-Jan-05 10:45
David Crow27-Jan-05 10:45 
GeneralRe: Is a directory on local PC? Pin
Neville Franks27-Jan-05 10:53
Neville Franks27-Jan-05 10:53 
Generalindex of min_element Pin
ns27-Jan-05 10:30
ns27-Jan-05 10:30 
Generalload jpeg into memory as bitmap Pin
Pia G27-Jan-05 9:11
Pia G27-Jan-05 9:11 
GeneralRe: load jpeg into memory as bitmap Pin
Neville Franks27-Jan-05 9:30
Neville Franks27-Jan-05 9:30 
GeneralRe: load jpeg into memory as bitmap Pin
PJ Arends27-Jan-05 9:49
professionalPJ Arends27-Jan-05 9:49 
QuestionHow to find Child window? Pin
Dody_DK27-Jan-05 8:34
Dody_DK27-Jan-05 8:34 
AnswerRe: How to find Child window? Pin
Wes Aday27-Jan-05 9:17
professionalWes Aday27-Jan-05 9:17 
GeneralRe: How to find Child window? Pin
Neville Franks27-Jan-05 9:33
Neville Franks27-Jan-05 9:33 
AnswerRe: How to find Child window? Pin
ThatsAlok27-Jan-05 18:56
ThatsAlok27-Jan-05 18:56 
AnswerRe: How to find Child window? Pin
rwestgraham29-Jan-05 23:01
rwestgraham29-Jan-05 23:01 
GeneralRe: How to find Child window? Pin
Dody_DK30-Jan-05 0:39
Dody_DK30-Jan-05 0:39 
GeneralRe: How to find Child window? Pin
rwestgraham30-Jan-05 14:19
rwestgraham30-Jan-05 14:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.