I've looked around on the net and in a couple books, but I can't find a way in C++ to divide two floats. Anybody have ideas?
I've looked around on the net and in a couple books, but I can't find a way in C++ to divide two floats. Anybody have ideas?
It's simple.. make 2 floats and use the division operator.
Perhaps you are stumbling over a more difficult problem, like changing ints to floats before the division, so things like 7/2 would result in the float value of 3.5 rather than the int value of 3?Code:#include <iostream> int main() { float a = 5.f; float b = 2.2f; float c = a/b; std::cout << c << '\n'; return 0; }