Link to home
Start Free TrialLog in
Avatar of lucie
lucie

asked on

CDialog Class Member Variable precision

How do I set the precision for the variables.  Similar to iostream.setprecision, Fortran "FIX" etc.  I would like not to convert back and forth between types.  Can't find this info in my books or the CD-ROM online help.  Thanks for any help in this "simple" matter.
Avatar of shaig
shaig
Flag of Afghanistan image

I don't understand what do CDialog members have to do with precision, and if they do, could you be more presice?

Anyway this is probably a C/C++ question:
the copnversion between types in C is automatic.
It is possible to set the precision when:
a) printing - sprintf or CString::Format.  example:
  sprintf( buffer, "The float value is: %8.2f", m_floatVarible );
b) inputing - scanf(), very simulare.

hope i helped.  : - {}
Avatar of lucie
lucie

ASKER

VC++ uses DDX/DDV to exchange data between the Dialog Control and the Member Variable.  In context:

m_floatVariable = sqrt(some_value);

When variable data sent back to the Dialog Control, the Dialog Box displays a number like 4.23592347575, when I'd like to see a number 4.24 or 4.236.  I've found that I can accomplish this by changing the type from "double" using the _fcvt function which allows you to control the # of digits after the decimal.  I'd just like to control rounding of the variable without changing types.  In fortran, I'd just FIX 2 or 3 and be done with it.  Just want to know if you can do this in VC++
ASKER CERTIFIED SOLUTION
Avatar of RONSLOW
RONSLOW

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lucie

ASKER

Thanks verrrrrrry much.