Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- switch (a)
- {
- case 1:
- if(matrix[0][0] == '1')
- matrix[0][0] = player_1;
- else
- {
- cout << "Field is already in use. Try again" << endl;
- input(); //Calling function input to prompt user to key in value again and again
- }
- break;
- case 2:
- if(matrix[0][1] == '2')
- matrix[0][1] = player_1;
- else {
- cout << "Field is already in use. Try again" << endl;
- input(); //Calling function input to prompt user to key in value again and again
- }
- break;
- case 3:
- if(matrix[0][2] == '3')
- matrix[0][2] = player_1;
- else {
- cout << "Field is already in use. Try again" << endl;
- input(); //Calling function input to prompt user to key in value again and again
- }
- break;
- case 4:
- if(matrix[1][0] == '4')
- matrix[1][0] = player_1;
- else {
- cout << "Field is already in use. Try again" << endl;
- input(); //Calling function input to prompt user to key in value again and again
- }
- break;
- case 5:
- if(matrix[1][1] == '5')
- matrix[1][1] = player_1;
- else {
- cout << "Field is already in use. Try again" << endl;
- input();//Calling function input to prompt user to key in value again and again
- }
- break;
- case 6:
- if(matrix[1][2] == '6')
- matrix[1][2] = player_1;
- else {
- cout << "Field is already in use. Try again" << endl;
- input();//Calling function input to prompt user to key in value again and again
- }
- break;
- case 7:
- if(matrix[2][0] == '7')
- matrix[2][0] = player_1;
- else {
- cout << "Field is already in use.Try again" << endl;
- input();//Calling function input to prompt user to key in value again and again
- }
- break;
- case 8:
- if(matrix[2][1] == '8')
- matrix[2][1] = player_1;
- else {
- cout << "Field is already in use. Try again" << endl;
- input();//Calling function input to prompt user to key in value again and again
- }
- break;
- case 9:
- if(matrix[2][2] == '9')
- matrix[2][2] = player_1;
- else {
- cout << "Field is already in use. Try again" << endl;
- input();//Calling function input to prompt user to key in value again and again
- }
- break;
- default:
- cout << "Number inputted doesn't exist. Please try again" << endl;
- input(); //Calling function input to prompt user to key in value again and again
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement