if_program.adb

来自「This contains the following topics and m」· ADB 代码 · 共 32 行

ADB
32
字号
-- For example, the following fragment of an Ada 95 program only prints out
--Hot!
-- when the contents of the memory location Temperature are greater than 30.

with Text_IO;             use Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure if_program is
   Temperature : Integer;
begin
   --Temperature := 30;
   while (True) loop
      Put ("Enter the temperature:");
      Get (Temperature);
      if Temperature <= 30 then --If temperature greater than 30
         Put ("its cool"); --Say its hot
         New_Line;
      elsif (Temperature > 30) and (Temperature <= 40) then
         Put ("its hot ");
         New_Line;
      elsif (Temperature > 40) and (Temperature <= 44) then
         Put ("its hot ");
         New_Line;
      elsif (Temperature > 44) and (Temperature < 49) then
         Put ("its horrible ");
         New_Line;
      elsif Temperature >= 49 then
         Put ("Extremly hot ");
         New_Line;
      end if;
   end loop;
end if_program;

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?