-- Centigrade to Farenheit temperature table
--
-- This program generates a list of Centigrade and Farenheit
-- temperatures with a note at the freezing point of water
-- and another note at the boiling point of water.
with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
procedure TempConv is
Centigrade, Farenheit : INTEGER;
begin
Put("Centigrade to Farenheit temperature table");
New_Line(2);
for Count in INTEGER range -2..12 loop
Centigrade := 10 * Count;
Farenheit := 32 + Centigrade * 9 / 5;
Put("C =");
Put(Centigrade, 5);
Put(" F =");
Put(Farenheit, 5);
if Centigrade = 0 then
Put(" Freezing point of water");
end if;
if Centigrade = 100 then
Put(" Boiling point of water");
end if;
New_Line;
end loop;
end TempConv;
019.一个略微有用的程序,摄氏度与华氏度之间的转换
最新推荐文章于 2024-04-06 00:08:32 发布
本文介绍了一个程序,用于生成从-20°C到120°C的摄氏度与华氏度温度对照表,特别标注了水的冰点和沸点。程序使用Ada语言编写,通过循环计算每个10°C间隔的对应华氏度。
391

被折叠的 条评论
为什么被折叠?



