Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <string.h>
  5.  
  6. int helpCommand() {
  7. printf(";rngNBit - Generates a random number of unsigned N Bits e.g ;rng4 will generate a number from 0-15 \n");
  8. };
  9.  
  10. int rngCommand4() { // Does actions if command is ;rng4
  11.  
  12. srand ( time(NULL) );
  13. int rng4Bit = rand();
  14.  
  15. printf("%d \n", rng4Bit);
  16.  
  17. };
  18. int main () {
  19. while(1) {
  20. char rngCommand[5] = ";rng4";
  21. char helpCommand[5] = "help";
  22.  
  23.  
  24. printf("CubeBot is currently functioning, please enter a command \n");
  25. scanf("%s", rngCommand);
  26. scanf("%s", helpCommand);
  27. if (strcmp(rngCommand, ";rng4") == 0) {rngCommand4();}
  28. else if (strcmp(helpCommand, ";help") == 0); { helpCommand();};
  29. }};
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement