diff options
author | 3gg <3gg@shellblade.net> | 2025-08-09 16:03:28 +0200 |
---|---|---|
committer | 3gg <3gg@shellblade.net> | 2025-08-09 16:03:28 +0200 |
commit | 727e3c59346da4f91284b34b4c18f2e0ba155e53 (patch) | |
tree | 807dccd5cba3c6bae2f8d0c9910157e306c6da5b /guess/src |
Diffstat (limited to 'guess/src')
-rw-r--r-- | guess/src/guess.adb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/guess/src/guess.adb b/guess/src/guess.adb new file mode 100644 index 0000000..dc394fa --- /dev/null +++ b/guess/src/guess.adb | |||
@@ -0,0 +1,20 @@ | |||
1 | with Ada.Text_IO; use Ada.Text_IO; | ||
2 | with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; | ||
3 | |||
4 | procedure Guess is | ||
5 | Answer : Integer := 47; | ||
6 | Guess : Integer; | ||
7 | begin | ||
8 | loop | ||
9 | Put ("Enter a number: "); | ||
10 | Get (Guess); | ||
11 | if Guess < Answer then | ||
12 | Put_Line ("Too low!"); | ||
13 | elsif Guess > Answer then | ||
14 | Put_Line ("Too high!"); | ||
15 | elsif Guess = Answer then | ||
16 | Put_Line ("Correct!"); | ||
17 | end if; | ||
18 | exit when Guess = Answer; | ||
19 | end loop; | ||
20 | end Guess; | ||