In C++ visual studio .net, I'm dividing two integer variables and trying to put the answer in a double variable. How do I get two integers to divide and give me a double data variable answer? Thanks

doub_a = inta / intb
.75 = 9/12

Promote one of the operands to double.

int a = 9, b = 12;
   double d = (double)a / b;

perfect, thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.