Add example inputs

This commit is contained in:
Alex Hirsch
2019-01-06 12:11:47 +01:00
parent 0045501c5e
commit bd7fae8198
36 changed files with 624 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
/* Test booleans and greater/smaller comparisons */
void guessNumber(int number, int max) {
bool success;
success = false;
while(!success) {
print("Enter a number between 0 and ");
print_int(max);
print("\n");
int guess;
guess = read_int();
success = guess == number;
if(success)
print("you guessed correct");
else {
if(guess < number)
print("the number is bigger\n");
else
print("the number is smaller\n");
}
}
print_nl();
}
int main() {
int test;
test = 3;
guessNumber(test, 10);
return 0;
}

View File

@@ -0,0 +1,4 @@
5
2
4
3

View File

@@ -0,0 +1,8 @@
Enter a number between 0 and 10
the number is smaller
Enter a number between 0 and 10
the number is bigger
Enter a number between 0 and 10
the number is smaller
Enter a number between 0 and 10
you guessed correct