program_6.adb
来自「This contains the following topics and m」· ADB 代码 · 共 25 行
ADB
25 行
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Age is
Age : Integer range 0 .. 100;
begin
Put ("hello, how old are you ? ");
Get (Age); -- might cause an exception if value entered is outside range
if Age < 18 then
Put_Line ("ha! you're just a baby");
elsif Age <= 10#6_0# then -- note spelling of elsif
Put_Line ("working hard?");
else
Put_Line ("Now take it easy old fella!");
end if;
exception
when Constraint_Error =>
Put_Line ("sorry only ages 0..100 are accepted");
end Age; -- procedure name is optional at end;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?