Link to home
Start Free TrialLog in
Avatar of Don Juan
Don Juan

asked on

Rounding w/ float

Take a look at the following code:

#include <conio.h>
#include <iostream.h>

void main()
{
  float MyVariable, YourVariable, OurVariable;
  MyVariable = 3.456;
  YourVariable = 3.75;
  OurVariable = MyVariable + YourVariable;
  cout << "Here is the value of OurVariable :" << OurVariable << endl;
}
 
I was wondering how I can round numbers in two ways:

1)  How can I round both values before I total them?

2)  How can I round the value of there sum to a certain number of decimal places?  
ASKER CERTIFIED SOLUTION
Avatar of bc022297
bc022297

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