Commit | Line | Data |
---|---|---|
79a323cb H |
1 | #include <stdio.h> |
2 | #include <string.h> | |
3 | #include <stdlib.h> | |
4 | ||
5 | int main() { | |
6 | int g, r, max = 10; | |
7 | char buff[80]; | |
8 | while(1) { | |
9 | r = rand() % max; | |
10 | printf("hadej cislo (od 0 do" | |
11 | "%d):", max - 1); | |
12 | fgets(buff, sizeof(buff)-2, stdin); | |
13 | *strpbrk(buff, "\r\n") = '\0'; | |
14 | if (!*buff) | |
15 | break; | |
16 | g = strtol(buff, NULL, 10); | |
17 | if(r == g) puts("Bravo maestro!"); | |
18 | else printf("Loooooooozre! " | |
19 | "bylo to %d\n", r); | |
20 | ||
21 | } | |
22 | puts("konec!"); | |
23 | } |