Posted by Erik on September 12, 2001 at 15:11:28:
In Reply to: Re: fix posted by wayne on September 11, 2001 at 16:31:22:
The problem comes from having the variables as integers and not floating point variables. When the calculations are performed the height and width are integers and only the aspect ratio is a double; hence, the value that the Aspect Ratio holds has the value of an integer, but the characteristics of a double (2.00). If you can treat the height and width as a double, your problems should be fixed.
If you change height and width to doubles, though, your output will show the value with a "." (ex: "12" would be shown as "12." if you use the "setprecision(0)" function where height and width are displayed).
: i have checked and double checked the code against what's on my computer. i have had the 3rd statement from the main function
: logFile << fixed << showpoint; from the beginning and i still get 2.00 as my aspect ratio for the first output file, and 0.00 for the other two. all other values are correct in each case.
: i don't know what the problem is...anyone have any other ideas, besides to keep checking on the 3rd line down from the main function?
: note - the typed code on my computer is EXACTLY the same as that on the source code given.
Post a Followup