View Single Post
  #2 (permalink)  
Old August 6th, 2009, 12:18 PM
DrPurdum DrPurdum is offline
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts
Default Temperature Conversion Problem

The reason it failed was because you used integer data types for the formula. When you converted 5/9 and assigned it into an integer data type, because integers can't express a fractional value, the result was zero. From that point on, you were working with zero for that result. If you change things to use the double data type, it would have worked correctly.
__________________
Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)