Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4.  
  5. void pokemonSelection(char *c1stName,char *c2ndName){
  6. char cPokemon1, cPokemon2;
  7. printf("\n\t %5s's Pokemon \t\t\t\t\t\t\t %5s's Pokemon \n", c1stName,c2ndName);
  8. printf("\t ============= \t\t\t\t\t\t\t =============\n");
  9. printf("\t|| ||\t\t\t\t\t\t\t|| || \n");
  10. printf("\t|| ||\t\t\t\t\t\t\t|| || \n");
  11. printf("\t|| ||\t\t\t\t\t\t\t|| || \n");
  12. printf("\t ============= \t\t\t\t\t\t\t =============\n");
  13. printf("\n\tProfessor Oak: %5s, please select your pokemon.", c1stName); // pokemon selection phase
  14. scanf("%c", &cPokemon1);
  15. printf("\n\tProfessor Oak: %5s, please select your pokemon.", c2ndName);
  16. scanf("%c", &cPokemon2);
  17. }
  18.  
  19. void firstPart(){
  20. char c1stName[5],c2ndName[5];
  21. /* gets the names of the two
  22. players */
  23. printf("(5characters only)\n");
  24. printf("Player 1 NAME:");
  25. scanf("%s", c1stName);
  26. fflush(stdin);
  27. printf("\nPlayer 2 NAME:");
  28. scanf("%s", c2ndName);
  29. fflush(stdin);
  30. pokemonSelection(c1stName, c2ndName);
  31. }
  32.  
  33. void start(){ // main screen
  34. char cChoice;
  35. printf("\t\t\t\t\t\t Enter:");
  36. scanf("%c", &cChoice);
  37. fflush(stdin);
  38. printf("\n");
  39. cChoice = tolower(cChoice); // to make the reply valid for lower and uppercase input
  40. if (cChoice == 'a' ){ // proceed to the main game
  41. firstPart();
  42. }
  43. else if (cChoice == 'b'){ // exits the program
  44. printf("\t\t\t\t\t THANK YOU FOR PLAYING");
  45. }
  46. else{ // invalid output
  47. printf("\t\t\t\t\t\t Wrong Input.\n");
  48. start();
  49. }
  50. }
  51.  
  52.  
  53. int main()
  54. {
  55. printf("\t\t\t\t ==============================================\n");
  56. printf("\t\t\t\t|| ||\n");
  57. printf("\t\t\t\t|| ||\n");
  58. printf("\t\t\t\t|| 1 V 1 ||\n");
  59. printf("\t\t\t\t|| ||\n");
  60. printf("\t\t\t\t|| POKEMON BATTLE SIMULATOR ||\n");
  61. printf("\t\t\t\t|| ||\n");
  62. printf("\t\t\t\t|| ||\n");
  63. printf("\t\t\t\t|| ||\n");
  64. printf("\t\t\t\t ==============================================\n\n");
  65. printf("\t\t\t\t [A] [B] \n");
  66. printf("\t\t\t\t START END \n");
  67. start();
  68.  
  69. return 0;
  70. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement