โปรแกรมแปลงอุณหภูมิ หัดทำ แนะนำด้วย
--------------------------------
program temp;
uses crt;
var temperature:real;
i:integer;
ans:char;
begin
repeat
clrscr;
writeln('***** Wellcome To Program Temperature Conversion *****');
writeln('------------------------------------------------------');
writeln('1.Convers Celsius To Fahrenheit,Reaumur,Kelvin');
writeln('2.Convers Fahrenheit To Celsius,Reaumur,Kelvin');
writeln('3.Convers Kelvin To Celsius,Reaumur,Fahrenheit');
writeln('4.Convers Reaumur To Celsius,Fahrenheit,Kelvin');
writeln;
write('Plese Select Program = ');
readln(i);
case i of
1 : begin
clrscr;
writeln('Program Convers Celsius To Fahrenheit,Reaumur,Kelvin');
writeln('--------------------------------------------------');
write('Input Temperature((-273.15)-300) = ');readln(temperature);
writeln('Temperature In Fahrenheit is = ',(9/5*temperature)+32:1:2);
writeln('Temperature In Reaumur is = ',0.8*temperature:1:2);
writeln('Temperature In Kelvin is = ',temperature+273.15:1:2);
end;
2 : begin
clrscr;
writeln('Program Convers Fahrenheit To Celsius,Reaumur,Kelvin');
writeln('----------------------------------------------------');
write('Input Temperature((-459.67)-572) = ');readln(temperature);
writeln('Temperature In Celsius is = ',5/9*(temperature-32):1:2);
writeln('Temperature In Reaumur is = ',(temperature-32)*4/9:1:2);
writeln('Temperature In Kelvin is = ',(temperature+459.67)*5/9:1:2);
end;
3 : begin
clrscr;
writeln('Program Convers Kelvin To Celsius,Reaumur,Fahrenheit');
writeln('----------------------------------------------------');
write('Input Temperature(0-573.15) = ');readln(temperature);
writeln('Temperature In Celsius is = ',temperature-273.15:1:2);
writeln('Temperature In Reaumur is = ',(temperature-273.15)*4/5:1:2);
writeln('Temperature In Fahrenheit is = ',temperature*9/5-459.67:1:2);
end;
4 : begin
clrscr;
writeln('Program Convers Reaumur To Celsius,Fahrenheit,Kelvin');
writeln('----------------------------------------------------');
write('Input Temperature((-218.52)-240) = ');readln(temperature);
writeln('Temperature In Celsius is = ',temperature*5/4:1:2);
writeln('Temperature In Kelvin is = ',temperature*5/4+273.15:1:2);
writeln('Temperature In Fahrenheit is = ',temperature*9/4+32:1:2);
end;
else
begin
clrscr;
writeln('Your Unkwon Choice!!')
end;
end;
writeln;
write('Plese Any Key To continue(Enter)');
readln;
clrscr;
Write('Do you want to continue (Y/N) = ');readln(ans);
ans:=upcase(ans);
until ans ='N';
end.
--------------------------------
program temp;
uses crt;
var temperature:real;
i:integer;
ans:char;
begin
repeat
clrscr;
writeln('***** Wellcome To Program Temperature Conversion *****');
writeln('------------------------------------------------------');
writeln('1.Convers Celsius To Fahrenheit,Reaumur,Kelvin');
writeln('2.Convers Fahrenheit To Celsius,Reaumur,Kelvin');
writeln('3.Convers Kelvin To Celsius,Reaumur,Fahrenheit');
writeln('4.Convers Reaumur To Celsius,Fahrenheit,Kelvin');
writeln;
write('Plese Select Program = ');
readln(i);
case i of
1 : begin
clrscr;
writeln('Program Convers Celsius To Fahrenheit,Reaumur,Kelvin');
writeln('--------------------------------------------------');
write('Input Temperature((-273.15)-300) = ');readln(temperature);
writeln('Temperature In Fahrenheit is = ',(9/5*temperature)+32:1:2);
writeln('Temperature In Reaumur is = ',0.8*temperature:1:2);
writeln('Temperature In Kelvin is = ',temperature+273.15:1:2);
end;
2 : begin
clrscr;
writeln('Program Convers Fahrenheit To Celsius,Reaumur,Kelvin');
writeln('----------------------------------------------------');
write('Input Temperature((-459.67)-572) = ');readln(temperature);
writeln('Temperature In Celsius is = ',5/9*(temperature-32):1:2);
writeln('Temperature In Reaumur is = ',(temperature-32)*4/9:1:2);
writeln('Temperature In Kelvin is = ',(temperature+459.67)*5/9:1:2);
end;
3 : begin
clrscr;
writeln('Program Convers Kelvin To Celsius,Reaumur,Fahrenheit');
writeln('----------------------------------------------------');
write('Input Temperature(0-573.15) = ');readln(temperature);
writeln('Temperature In Celsius is = ',temperature-273.15:1:2);
writeln('Temperature In Reaumur is = ',(temperature-273.15)*4/5:1:2);
writeln('Temperature In Fahrenheit is = ',temperature*9/5-459.67:1:2);
end;
4 : begin
clrscr;
writeln('Program Convers Reaumur To Celsius,Fahrenheit,Kelvin');
writeln('----------------------------------------------------');
write('Input Temperature((-218.52)-240) = ');readln(temperature);
writeln('Temperature In Celsius is = ',temperature*5/4:1:2);
writeln('Temperature In Kelvin is = ',temperature*5/4+273.15:1:2);
writeln('Temperature In Fahrenheit is = ',temperature*9/4+32:1:2);
end;
else
begin
clrscr;
writeln('Your Unkwon Choice!!')
end;
end;
writeln;
write('Plese Any Key To continue(Enter)');
readln;
clrscr;
Write('Do you want to continue (Y/N) = ');readln(ans);
ans:=upcase(ans);
until ans ='N';
end.