service{
const html Begin =
This is a tool for all people having trouble with Fahrenheight/Celsius Temperature conversions.
(think of all the times you had 96 degree temperature when anybody having above 42 is cosidered seriously dead :)
input a value
;
const html ToChoice =
SO - you whish for a conversion ...
Convert <[orig_val]> <[from]> to
;
const html Result =
Our \"computationally intensive\" algorithm gives the following result:
<[orig_val]> <[from]> = <[result]><[to]>
Quit
;
const html End =
Than you for using our script <[count]> times
Please continue on your quest for Knowledge :
Google
;
session Conversion(){
int orig_val, result, quit, count;
string from, to, opt;
int type;
orig_val=0;
result =99;
quit=0;
count =0;
while(quit!=1){
show Begin receive[orig_val=orig_val, from = from];
show plug ToChoice[orig_val = orig_val, from= from] receive[to = to];
if(from=="°F"){
if(to=="°C") { result = ((orig_val -32)*5)/9; }
else if(to=="°K") { result = ((orig_val -32)*5)/9 + 273; }
else { result = orig_val;}
}
else if(from == "°C"){
if(to == "°F"){ result = ((orig_val*9)/5)+32;}
else if(to == "°K"){ result = (orig_val + 273); }
else{ result = orig_val;}
}
else if(from == "°K"){
if(to == "°C"){ result = (orig_val - 273); }
else if(to == "°F"){ result = ((orig_val -273)*9)/5 + 32 ; }
else { result = orig_val; }
}
show plug Result [from = from, orig_val = orig_val, to = to , result = result]
receive [quit = quit];
count = count +1;
}
exit plug End [count = count];
}
}