This should be a fairly easy question.
I have two int variables I need to divide to get a float.
Code:int a=6; int b=4; float c=a/b;
This code keeps giving me 1, and I need 1.5.
This is a discussion on int division to float within the C++ Programming forums, part of the General Programming Boards category; This should be a fairly easy question. I have two int variables I need to divide to get a float. ...
This should be a fairly easy question.
I have two int variables I need to divide to get a float.
Code:int a=6; int b=4; float c=a/b;
This code keeps giving me 1, and I need 1.5.
Code:int a=6; int b=4; float c=float(a)/float(b);
I don't see why people think Chuck Norris is so awesome. If he was really as great as they say, he would be over here slamming my head into the keybsk;lah;flksalfksdnlcslcnsldk;acklsd;glfbaskfl
/* When I wrote this, only God and I understood what I was doing... Now, God only knows */
nifty
thanks
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.