Unknown problem.

Hey!

When I execute the following code..


1
2
3
double test = (17+51*60+37*3600)/3600 // for example..

cout << test << endl;


I get 37.000 printed out instead of 37.854.

Any idea?
If you divide an integer with an integer, the result will be an integer, regardless of the type of variable that you store it in.

If you divide a double by an integer or the other way around, the result will be a double.

Try adding .0 to one of the numbers.
Oh wow really.. I'm so dumb.. Thanks for your reply ^^
Topic archived. No new replies allowed.