Question: Part 3 : write a program to determine the winner of a tic tac toe board For this program the user will enter 9 chars

Part 3: write a program to determine the winner of a tic tac toe board
For this program the user will enter 9 chars- they will represent a tic tac toe board from left to right, top to bottom for example the input XOOOXXXOX represents
X O O
O X X
X O X
and x is the winner.
you can use cin >> x >> y >> z >> p >> q; (or longer) to get a bunch of space seperated input at once from the user
if there is no winner it will print out "it was a tie"
Code provided:
#include
using namespace std;
int main(){
cout<<"Enter the board (left to right, top to bottom): ";
if (b11== b12 && b12== b13){
winner = b11;
}
if (b21== b22 && b22== b23){
winner = b21;
}
if (b31== b32 && b32== b33){
winner = b31;
}
return 0;
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!