aboutsummaryrefslogtreecommitdiff
path: root/games/gameguess.c
blob: ad6c9be052eafafed8bede0b81cee53e676a2bb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdlib.h>
#include "../rat.h"

void gameguess(){
int guess;
int solved = 0;
int range = 100;

int correct = (rand() % (range + 1));

printf("let's play a game, squeak!~ you gues a number between 0 and %d!\n", range);


while(solved != 1){

scanf("%d", &guess);

if(guess < correct){
printf("number too low try again\n");
}else if(guess > correct){
printf("number too high try again\n");
}else {printf("yes!! correct! squeaaakk!~\n"); solved = 1;}
}

    addstat(&rat.fun);

}