📄 while_with_if_program.adb
字号:
with Text_IO; use Text_IO;
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
procedure while_with_if_program is
Price_Per_Kilo : Float; --Price of apples
Kilos_Of_Apples : Float; --Apples required
Cost : Float; --Cost of apples
lines_output : Integer := 0;
count : Integer := 10;
begin
Price_Per_Kilo := 1.20;
-- put(integer'image(count)); -- delivers count as a character string.
New_Line;
Put ("Cost of apples per kilo : ");
Put (Price_Per_Kilo);
New_Line;
Put (" Kilo's Cost");
New_Line;
Kilos_Of_Apples := 1.0;
while Kilos_Of_Apples <= 10.0 loop --While lines to print
Cost := Price_Per_Kilo * Kilos_Of_Apples; --Calculate cost
Put (Kilos_Of_Apples); --Print results
Put (" ");
Put (Cost);
New_Line;
Kilos_Of_Apples := Kilos_Of_Apples + 1.0; --Next value
lines_output := lines_output + 1;
delay 1.0; -- wait for 1 second
if lines_output >= 4 then
New_Line;
lines_output := 0;
end if;
end loop;
end while_with_if_program;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -