diff options
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; | ||
