I am having trouble with my Tic Tac Toe console game. I have the user enter which row/column they want to place their piece, although on coordinate (1, 3) it places a piece there, but also at coordinate (2, 1). This also happens vice versa and at (2, 3) and (3, 1). Here is the code (it is no where near complete, I just need to resolve this issue before I can move forward).
main.cpp
#include "GameSystem.h"
#include <iostream>
using namespace std;
int main()
{
GameSystem gamesystem;
gamesystem.playGame();
return 0;
}
GameSystem.h
#ifndef GAMESYSTEM_H
#define GAMESYSTEM_H
#include <iostream>
using namespace std;
class GameSystem
{
public:
GameSystem();
void instructions();
void updateBoard();
void playGame();
int chooseSpot();
char processMove();
int resetInput();
void GameSystem::instructions()
{
cout << "\t\tWelcome to Tic Tac Toe!\n\n";
cout << "X goes first, then O" << endl;
cout << "Choose at which place to put the piece by entering the row and column" << endl;
cout << "Try to get three in a row (diagonally, horizontally, or vertically)" << endl;
}
Thanks so much! Sorry for the lack-of-tabbing-over: it wouldn't let me post the code like it should be :P. Again, thanks for the help - I didn't know one line of code could fix this issue.