You can’t if you define them as int. Try with double or float instead. 
double x;
double y;
double div;
Changing the definition solves the problem.
0
solved How do I get decimals in C++ if I’m using integer variables
 
You can’t if you define them as int. Try with double or float instead. 
double x;
double y;
double div;
Changing the definition solves the problem.
0
solved How do I get decimals in C++ if I’m using integer variables