fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. // define
  5. #define PLAYER_HP 500
  6. #define ATK_DAMAGE 50
  7.  
  8. // function prototypes
  9.  
  10. // main
  11.  
  12. int main (void)
  13. {
  14.  
  15.  
  16. char response;
  17.  
  18. printf("would you like to start a battle?: y/n \n");
  19. scanf(" %c", &response);
  20. if (response == 'Y')
  21. {
  22. printf("test\n"); // run all code that starts game
  23. }
  24. else if (response == 'N')
  25. {
  26. printf("bye bye!\n");
  27. }
  28. else if (response != 'Y' && response != 'N')
  29. {
  30. printf("enter valid response\n");
  31. }
  32.  
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0.01s 5320KB
stdin
J
stdout
would you like to start a battle?: y/n 
enter valid response