dWidthToLength = (nRoomWidth / nRoomLength);
ok. dWidthToLenght is a double. but nRoomWidth and nRoomLenght are INTEGERS. you need to open your book up, and look up Integer division. it's not the same as normal division. if you divide integers, you will get an integer answer, that is equal to the floor of the decimal division of the 2 values. so 2/4 = 2. 2/5 will ALSO =2. ALWAYS. because you're deviding INTEGERS.
to prevent this, you can do 2 things.
1: cast nRoomWidth and nRoomLength as doubles or floats.
2: make nRoomWidth and nRoomLength doubles or floats.
that's it. those are your options.
|