24 lines
437 B
Plaintext
24 lines
437 B
Plaintext
// NOTE: DO NOT TEST WITH build.sh because geti (input)
|
|
void guessing_game(int n)
|
|
{
|
|
int x = 4; // no syscall for rand in spim -_-
|
|
int res = -1;
|
|
while (res != x) {
|
|
puts("Guess the number\n");
|
|
res = geti();
|
|
if (res < x) {
|
|
puts("Too little\n");
|
|
} else if (res > x) {
|
|
puts("Too big\n");
|
|
}
|
|
}
|
|
puts("Bravo, you guessed!\n");
|
|
}
|
|
|
|
int main()
|
|
{
|
|
puts("Hello, enter a max for guessing game\n");
|
|
guessing_game(10);
|
|
return 0;
|
|
}
|