Click here to Skip to main content
16,010,544 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralBackground and text colors of the date/time picker Pin
Serge Weinstock25-Jun-01 0:07
Serge Weinstock25-Jun-01 0:07 
GeneralDisable pages on a CPropertysheet Pin
24-Jun-01 23:48
suss24-Jun-01 23:48 
GeneralRe: Disable pages on a CPropertysheet Pin
Tomasz Sowinski25-Jun-01 1:53
Tomasz Sowinski25-Jun-01 1:53 
GeneralAPI for obtaining Subnet Mask Pin
Yamuna24-Jun-01 23:47
Yamuna24-Jun-01 23:47 
GeneralRound() function Pin
24-Jun-01 23:30
suss24-Jun-01 23:30 
GeneralRe: Round() function Pin
Christian Graus24-Jun-01 23:44
protectorChristian Graus24-Jun-01 23:44 
GeneralTry these... Pin
Anna-Jayne Metcalfe25-Jun-01 0:34
Anna-Jayne Metcalfe25-Jun-01 0:34 
GeneralRe: Round() function Pin
#realJSOP25-Jun-01 3:35
professional#realJSOP25-Jun-01 3:35 
Here's some code for you. The first finction returns an int, and the second one returns a double rounded to the nearst number of decimal places. The last two functions are just in case you want a double rounded up or down to the nearest integer value. Merely adding or subtracting 0.5 to the original value and calling Rounder with that value will yield the desired result.

int Rounder(double dValue)
{
    char sBuf[64];
    // sprintf does the rounding for you
    sprintf(sBuf, "%0.lf", dValue);
    return atoi(sBuf);  
}

double Rounder(double dValue, int nDigits)
{
    char sBuf[64];
    // sprintf does the rounding for you to the number of digits you want
    sprintf(sBuf, "%0.*lf", nDigits, dValue);
    return atof(sBuf);
}

int RoundUp(double dValue)
{
    return Rounder(dValue + 0.5);
}

int RoundDown(dowble dValue)
{
    return Rounder(dValue - 0.5);
}

GeneralRe: Round() function Pin
25-Jun-01 5:34
suss25-Jun-01 5:34 
GeneralRound() function Pin
24-Jun-01 23:29
suss24-Jun-01 23:29 
GeneralWhere is the real error about CArray::GetAt(int n) function Pin
24-Jun-01 21:30
suss24-Jun-01 21:30 
GeneralRe: Where is the real error about CArray::GetAt(int n) function Pin
markkuk24-Jun-01 21:43
markkuk24-Jun-01 21:43 
GeneralRe: Where is the real error about CArray::GetAt(int n) function Pin
Tomasz Sowinski25-Jun-01 1:43
Tomasz Sowinski25-Jun-01 1:43 
Generalusing two table in 1 software Pin
24-Jun-01 21:12
suss24-Jun-01 21:12 
GeneralRe: using two table in 1 software Pin
Tim Deveaux25-Jun-01 4:51
Tim Deveaux25-Jun-01 4:51 
GeneralSuperb Pin
25-Jun-01 14:51
suss25-Jun-01 14:51 
GeneralRe: Superb Pin
25-Jun-01 20:28
suss25-Jun-01 20:28 
GeneralRe: Superb Pin
Tim Deveaux26-Jun-01 13:25
Tim Deveaux26-Jun-01 13:25 
GeneralPrint preview Pin
24-Jun-01 21:00
suss24-Jun-01 21:00 
GeneralRe: Print preview Pin
Christian Graus24-Jun-01 23:30
protectorChristian Graus24-Jun-01 23:30 
GeneralRe: Print preview Pin
25-Jun-01 20:24
suss25-Jun-01 20:24 
GeneralRe: Print preview Pin
Christian Graus25-Jun-01 23:13
protectorChristian Graus25-Jun-01 23:13 
GeneralQuestion about the file of VC Project Pin
24-Jun-01 20:26
suss24-Jun-01 20:26 
GeneralRe: Question about the file of VC Project Pin
Michael Dunn24-Jun-01 21:28
sitebuilderMichael Dunn24-Jun-01 21:28 
GeneralProblem of Print Mechanism! Pin
24-Jun-01 19:54
suss24-Jun-01 19:54 

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.