aboutsummaryrefslogtreecommitdiff
path: root/games/gameguess.c
diff options
context:
space:
mode:
Diffstat (limited to 'games/gameguess.c')
-rw-r--r--games/gameguess.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/games/gameguess.c b/games/gameguess.c
new file mode 100644
index 0000000..ad6c9be
--- /dev/null
+++ b/games/gameguess.c
@@ -0,0 +1,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);
+
+}