Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. switch (a)
  2. {
  3. case 1:
  4. if(matrix[0][0] == '1')
  5. matrix[0][0] = player_1;
  6.  
  7. else
  8. {
  9. cout << "Field is already in use. Try again" << endl;
  10. input(); //Calling function input to prompt user to key in value again and again
  11. }
  12. break;
  13.  
  14. case 2:
  15. if(matrix[0][1] == '2')
  16. matrix[0][1] = player_1;
  17. else {
  18.  
  19. cout << "Field is already in use. Try again" << endl;
  20. input(); //Calling function input to prompt user to key in value again and again
  21. }
  22. break;
  23. case 3:
  24. if(matrix[0][2] == '3')
  25. matrix[0][2] = player_1;
  26. else {
  27.  
  28. cout << "Field is already in use. Try again" << endl;
  29. input(); //Calling function input to prompt user to key in value again and again
  30. }
  31. break;
  32. case 4:
  33. if(matrix[1][0] == '4')
  34. matrix[1][0] = player_1;
  35. else {
  36.  
  37. cout << "Field is already in use. Try again" << endl;
  38. input(); //Calling function input to prompt user to key in value again and again
  39. }
  40. break;
  41. case 5:
  42. if(matrix[1][1] == '5')
  43. matrix[1][1] = player_1;
  44. else {
  45.  
  46. cout << "Field is already in use. Try again" << endl;
  47. input();//Calling function input to prompt user to key in value again and again
  48. }
  49. break;
  50. case 6:
  51. if(matrix[1][2] == '6')
  52. matrix[1][2] = player_1;
  53. else {
  54.  
  55. cout << "Field is already in use. Try again" << endl;
  56. input();//Calling function input to prompt user to key in value again and again
  57. }
  58. break;
  59. case 7:
  60. if(matrix[2][0] == '7')
  61. matrix[2][0] = player_1;
  62. else {
  63.  
  64. cout << "Field is already in use.Try again" << endl;
  65. input();//Calling function input to prompt user to key in value again and again
  66. }
  67. break;
  68. case 8:
  69. if(matrix[2][1] == '8')
  70. matrix[2][1] = player_1;
  71. else {
  72.  
  73. cout << "Field is already in use. Try again" << endl;
  74. input();//Calling function input to prompt user to key in value again and again
  75. }
  76. break;
  77. case 9:
  78. if(matrix[2][2] == '9')
  79. matrix[2][2] = player_1;
  80.  
  81. else {
  82.  
  83. cout << "Field is already in use. Try again" << endl;
  84. input();//Calling function input to prompt user to key in value again and again
  85. }
  86. break;
  87. default:
  88. cout << "Number inputted doesn't exist. Please try again" << endl;
  89. input(); //Calling function input to prompt user to key in value again and again
  90. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement