kelsjane24
Sep 9, 2008, 05:12 PM
Ok I am writing a program that asks the user to insert two numbers and the program then divides the numbers they choose. However, when the program divides these numbers it shows 2.00 when really it should be 2.44. How do I make the program show what the answer really is. Please Help! Thanks!!
Scleros
Sep 11, 2008, 07:38 PM
Hint: check your variable type declarations.
mani_jeddah
Oct 15, 2008, 12:32 PM
Simply use the data type "float or double" but don't use int!
Vote for my ans if it is useful
Libran
May 20, 2009, 07:00 AM
One way is simply use float or double instead of int.
Or make use of type casting feature (explicit typecasting)
Cout<<float (a/b);