swap.adb

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

ADB
32
字号
with Ada.Text_IO, Ada.Integer_Text_IO;-- Ada.Swap;
use Ada.Text_IO, Ada.Integer_Text_IO;
procedure Main is
   Books_Room_1 : Integer;
   Books_Room_2 : Integer;
   procedure swap (First : in out Integer; Second : in out Integer) is
      Temp : Integer;
   begin
      Temp   := First;
      First  := Second;
      Second := Temp;
   end swap;
begin
   Books_Room_1 := 10;
   Books_Room_2 := 20;
   Put ("Books in room 1 =");
   Put (Books_Room_1);
   New_Line;
   Put ("Books in room 2 =");
   Put (Books_Room_2);
   New_Line;
   Put ("Swap around");
   New_Line;
   swap (Books_Room_1, Books_Room_2);
   Put ("Books in room 1 =");
   Put (Books_Room_1);
   New_Line;
   Put ("Books in room 2 =");
   Put (Books_Room_2);
   New_Line;
end Main;

⌨️ 快捷键说明

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