Make the result of integer division a float
#include <iostream> using namespace std; int main(void) { int firstOp = 10, secondOp = 4; float result = (float) firstOp / secondOp; cout << firstOp << " / " << secondOp << " = " << result; return 0; }