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?
#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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.