View Full Version : Help needed with an if/else statement

01-24-2006, 01:24 PM
Hi All,

Please could somebody offer me some help with my temperature program (attached) it runs all the variables except for the above 100 degrees, which should output 'The water has turned to steam' but it just seems to ignore this and tell me 'The water is liquid'. Where have I gone wrong??

I need this help for an assignment that has to be submitted today at the very latest, so any help would be really appreciated.

Thank you in advance.


01-24-2006, 01:49 PM
Can we see what you have done. Will help to see what you have done.

01-24-2006, 02:11 PM
Oops, sorry - that was rather silly of me, I thought I had managed to attach the program file to the message! I will try again.

Thanks again,


01-24-2006, 02:13 PM
Ok. Sorry but there was nothing in that file.

01-24-2006, 03:51 PM
Hi MrMan,

Ok, I may need some help here then to get this file downloaded (uploaded?). I did this the other day quite easily so goodness knows what is going wrong here!! This is a program file written in Notepad, and run in Netscape - to attach it to this forum I saved it as a text (.txt) file and then as a word document for ease of reading for the majority (?) of users. I am feeling rather panicked about missing the cut off date of my uni assignment now (midnight), so would greatly appreciate all and any help offered via this forum - please!!!!

Could someone please advise how do I upload/download my file so that it can be viewed on this forum and commented on?

Huge thank you's to yourself and anyone else reading this thread that can offer assistance here.

Kindest regards,


01-24-2006, 04:18 PM
Don't bother about using the files to upload to the site. just copy the code and put it between some code tags
i.e {CODE}{/CODE}
there { = shift+{

01-24-2006, 10:39 PM
The way an if/else block works, if the if condition evaluates to true, the else is never reached.

change this statement

if (theTemperature >= 0)

to this

if ((theTemperature >= 0)&&(theTemperature<100))

and you should be good to go

01-24-2006, 11:12 PM
Hi there,

Thank you for your help. I have less than two hours to submit my assignment now!!! Thing is, I have just run this program with the new code and it is still telling me that the water at 101 degrees is liquid as opposed to ice. Please could you offer some further help?

Thank you in advance (and anticipation)


01-24-2006, 11:25 PM
Hi 2reikis,

Thank you for sending me your help, I have finally been able to submit my uni assignment and am really grateful for your input.

Thank you again, big time,