Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <limits.h>
- #include <time.h>
- #include <stdbool.h>
- #include <string.h>
- int main() {
- srand(time(NULL));
- char str[256] = {0};
- puts("If you want to have a random number in [1,100] write /roll\nIf you want to exit write exit");
- while (true) {
- gets(str);
- if (!(strcmp(str, "/roll"))) {
- printf("%i\n", (rand()%100) + 1);
- } else if (!(strcmp(str, "exit"))) {
- puts("Have a nice day");
- break;
- } else {
- puts("Wrong command, try again");
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment