嗯... 它展平了缩进。 唉...
我猜这是你收藏中的稀有物品:Ada 版本
with Ada.Text_IO; use Ada.Text_IO;with Ada.Numerics.Discrete_Random;
procedure Main istype Game_Value is range 1 .. 100;
package Game_Io isnew Ada.Text_IO.Integer_IO (Game_Value);
package Game_Random isnew Ada.Numerics.Discrete_Random (Game_Value);
Random_Generator : Game_Random.Generator;
Guess_Me : constant Game_Value := Game_Random.Random (Random_Generator);User_Guess : Game_Value;beginloopGame_Io.Get (User_Guess);
if User_Guess > Guess_Me thenPut_Line ("Too large");
elsif User_Guess < Guess_Me thenPut_Line ("Too small");
elsePut_Line ("Correct!");exit;end if;end loop;end Main;
撰写评论
嗯... 它展平了缩进。 唉...
我猜这是你收藏中的稀有物品:Ada 版本
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Numerics.Discrete_Random;
procedure Main is
type Game_Value is range 1 .. 100;
package Game_Io is
new Ada.Text_IO.Integer_IO (Game_Value);
package Game_Random is
new Ada.Numerics.Discrete_Random (Game_Value);
Random_Generator : Game_Random.Generator;
Guess_Me : constant Game_Value := Game_Random.Random (Random_Generator);
User_Guess : Game_Value;
begin
loop
Game_Io.Get (User_Guess);
if User_Guess > Guess_Me then
Put_Line ("Too large");
elsif User_Guess < Guess_Me then
Put_Line ("Too small");
else
Put_Line ("Correct!");
exit;
end if;
end loop;
end Main;