Temperature Converter by textile guy djbjrca16th May 2004 21:46
|
---|
Summary This is a little useful temperature converter between four scales. Might be interesting. It was my first program. Description This is the temperature converter that I made to test out DarkBASIC. It is pretty simple, but is also useful. NOt much else to say. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com start: do input "Press ENTER to continue";aa$ cls print "***It's the temperature converter!***" print "Please enter one of these numbers:" print "<1> for Farenheit to Celcius" print "<2> for Celcius to Farenheit" print "<3> for Celcius to Kelvin" print "<4> for Kelvin to Celcius" print "<5> for Farenheit to Kelvin" print "<6> for Kelvin to Farenheit" print "<7> for Farenheit to Rankine" print "<8> for Rankine to Farenheit" print "<9> for Celcius to Rankine" print "<10> for Rankine to Celcius" print "<11> for Rankine to Kelvin" print "<12> for Kelvin to Rankine" print "<13> for info on scales" print "<14> for an Ascii chart this is completely random" input "<15> to exit>";tc if tc=1 then goto ftoc if tc=2 then goto ctof if tc=3 then goto ctok if tc=4 then goto ktoc if tc=5 then goto ftok if tc=6 then goto ktof if tc=7 then goto ftor if tc=8 then goto rtof if tc=9 then goto ctor if tc=10 then goto rtoc if tc=11 then goto rtok if tc=12 then goto ktor if tc=13 then goto help if tc=14 then goto acsii if tc=15 then end if tc=>15 print "That is not a choice" goto start endif loop ftoc: print "***Farenheit-Centigrade Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to centigrade!" input "Enter the degrees farenheit, just a number>";d b=((d-32)*5)/9 if b < 11 then print "Brrrr!!!" if b > 32 then print "Ouch!" if b > 11 and b < 32 then print "Ahhh..." print b goto start ctof: print "***Centigrade-Farenheit Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to farenheit!" input "Enter the degrees centigrade, just a number>";d b=((d*9)/5)+32 if b < 52 then print "Brrrr!!!" if b > 90 then print "Ouch!" if b > 52 and b < 90 then print "Ahhh..." print b goto start ctok: print "***Centigrade-Kelvin Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to kelvin!" input "Enter the degrees centigrade, just a number>";d b=d+273.15 if b < 284 then print "Brrrr!!!" if b > 311 then print "Ouch!" if b > 284 and b < 311 then print "Ahhh..." print b goto start ktoc: print "***Kelvin-Centigrade Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to centigrade!" input "Enter the degrees kelvin, just a number>";d b=d-273.15 if b < 11 then print "Brrrr!!!" if b > 32 then print "Ouch!" if b > 11 and b < 32 then print "Ahhh..." print b goto start ftok: print "***Farenheit-Kelvin Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to kelvin!" input "Enter the degrees farenheit, just a number>";d b=((d-32)*5)/9 c=b+273.51 if c < 284 then print "Brrrr!!!" if c > 311 then print "Ouch!" if c > 284 and c < 311 then print "Ahhh..." print c goto start ktof: print "***Kelvin-Farenheit Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to farenheit!" input "Enter the degrees kelvin, just a number>";d b=d-273.15 c=((b*9)/5)+32 if c < 52 then print "Brrrr!!!" if c > 90 then print "Ouch!" if c > 52 and c < 90 then print "Ahhh..." print c goto start ftor: print "***Farenheit-Rankine Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to Rankine!" input "Enter the degrees farenheit, just a number>";d b=d+459 if b < 511 then print "Brrrr!!!" if b > 549 then print "Ouch!" if b > 511 and b < 549 then print "Ahhh..." print b goto start rtof: print "***Rankine-Farenheit Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to Farenheit!" input "Enter the degrees rankine, just a number>";d b=d-459 if b < 52 then print "Brrrr!!!" if b > 90 then print "Ouch!" if b > 52 and b < 90 then print "Ahhh..." print b goto start ctor: print "***Centigrade-Rankine Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to Rankine!" input "Enter the degrees centigrade, just a number>";d b=((d*9)/5)+32 c=b+459 if c < 511 then print "Brrrr!!!" if c > 549 then print "Ouch!" if c > 511 and c < 549 then print "Ahhh..." print c goto start rtoc: print "***Rankine-Centigrade Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to centigrade!" input "Enter the degrees rankine, just a number>";d b=d-459 c=((b-32)*5)/9 if c < 11 then print "Brrrr!!!" if c > 32 then print "Ouch!" if c > 11 and c < 32 then print "Ahhh..." print c goto start help: print "I am assuming that you already know what Farenheit and" print "Centigrade are. If not, this is the wrong guide to use." print "There is a temperature called absolute zero. It is the" print "coldest temperature possible because the molecules can't" print "cling together any more. There are two temperature scales" print "in whic zero is absolute zero. They are called Kelvin and" print "Rankine. Kelvin uses Cenigrade intrevals and Rankine uses" print "Farenheit intravels." goto start rtok: print "***Rankine-Kelvin Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to kelvin!" input "Enter the degrees rankine, just a number>";d b=((d-32)*5)/9 if b < 284 then print "Brrrr!!!" if b > 311 then print "Ouch!" if b > 284 and b < 311 then print "Ahhh..." print b goto start ktor: print "***Kelvin-Rankine Converter!***" print "Enter a number that would be a temperature without the degrees sign..." print "and I will convert it to Rankine!" input "Enter the degrees kelvin, just a number>";d b=((d*9)/5)+32 if b < 511 then print "Brrrr!!!" if b > 549 then print "Ouch!" if b > 511 and b < 549 then print "Ahhh..." print b goto start acsii: print "Here!" for t = 1 to 255 print chr$(t); next t print "Press any key to continue" suspend for key goto start |