I made some changes to my class structure and the way I determine a win.  I was attempting to decide if it made sense to keep the player completely isolated to TicTacToe game class or if it made sense to make a player class to add additional functionality.So that you can see the progress of the code my initial implementation without classes can be found here and my first implementation with classes can be found here.I decided to separate out the bool getUserWantToPlay() function from the game class simply because the user could cin a negative answer and avoid creating an instance of the TicTacToe class all together.  Is that proper thinking?Ideally from this review, I would like to receive further advice on class implementation as well as recommendations on how classes should interact with each other.  Improving my code with built in functions and clear concise syntax would also be great.Main//implementation of TicTacToe//Using classes this time#include <iostream>#include TicTacToeClass.hbool getUserWantToPlay();int main(){    //Assumes no play unless user decides they want to play and initializes game variable to TicTacToe class    bool play = false;    play = getUserWantToPlay();    //allows for multiple games to be played    while(play == true)    {        TicTacToe game;        char playerWinner = 'n';        char player = 'X';        //single game iteration        while(playerWinner == 'n')        {            game.drawBoard();            game.getPlayerMove(player);            playerWinner = game.checkForWin(player);            if(playerWinner == 'n')            {                player = game.togglePlayer(player);            }        }        game.drawBoard();        game = TicTacToe();        play = getUserWantToPlay();    }    return(0);}Class Header/* * TicTacToeClass.h * *  Created on: Jun 15, 2016 *      */#ifndef TICTACTOECLASS_H_#define TICTACTOECLASS_H_class TicTacToe{    public:        TicTacToe();        void drawBoard();        void getPlayerMove(char player);        char togglePlayer(char player);        char checkForWin(char player);    private:        char squareArray[9];        int moveCounter;};#endif /* TICTACTOECLASS_H_ */Class Implementation//TicTacToe class implementation//Leeroy Jenkins#include TicTacToeClass.h#include <iostream>TicTacToe::TicTacToe(): squareArray{'1','2','3','4','5','6','7','8','9'},  moveCounter(0){}bool getUserWantToPlay(){    char response;    bool invalidResponse = true;    bool play = false;    while(invalidResponse == true)    {        std::cout << Would you like to play a new game of TicTacToe? (y/n)  << std::endl;        std::cin >> response;        if(response == 'y')        {            invalidResponse = false;            play = true;        }        else if(response == 'n')        {            std::cout << No Problem!;            invalidResponse = false;        }        else        {            std::cout << Please input a proper response (y/n) << std::endl;        }    }    return play;}void TicTacToe::drawBoard(){    //draws the game board with updated characters for each player        std::cout << Player 1 (X) - Player 2 (O) << std::endl << std::endl << std::endl;        std::cout <<     |     | << std::endl;        std::cout <<   << squareArray[0] <<   |   << squareArray[1] <<   |   << squareArray[2] << std::endl;        std::cout << ____|_____|____ << std::endl;        std::cout <<     |     |     << std::endl;        std::cout <<   << squareArray[3] <<   |   << squareArray[4] <<   |   << squareArray[5] << std::endl;        std::cout << ____|_____|____ << std::endl;        std::cout <<     |     |     << std::endl;        std::cout <<   << squareArray[6] <<   |   << squareArray[7] <<   |   << squareArray[8] << std::endl;}void TicTacToe::getPlayerMove(char player){    //Gets player move and stores in board array for display through next iteration    bool playerMoveFound = false;    char playerTurn = '0';    char playerMove = '0';    if(player == 'X')    {        playerTurn = '1';    }    else    {        playerTurn = '2';    }    while(playerMoveFound == false)    {        std::cout << Player  << playerTurn <<  please make a move << std::endl;        std::cin >> playerMove;        for(int counter = 0; counter < 9; counter++)        {            //If finds the array number makes the change to the iteration...prevents x or o movement            if(playerMove == squareArray[counter] && playerMove != 'X' && playerMove != 'O' && playerMove != 'x' && playerMove != 'o')            {                squareArray[counter] = player;                playerMoveFound = true;                //Move counter implemented to streamline check for win/check for tie                moveCounter++;            }        }        if(playerMoveFound == false)        {            std::cout << Invalid player move... << std::endl;        }    }}char TicTacToe::checkForWin(char player){    char playerWin = 'n';    //Ignores iteration if move counter is less than 5 since win/tie impossible until that point    if(moveCounter >= 5)    {        //Test rows for win        for(int rowCounter = 0; rowCounter < 8; rowCounter+=2)        {            if(squareArray[rowCounter] == squareArray[rowCounter + 1] && squareArray[rowCounter + 1] == squareArray[rowCounter + 2])            {                playerWin = player;            }        }        //Tests columns for win        for(int columnCounter = 0; columnCounter < 3; columnCounter++)        {            if(squareArray[columnCounter] == squareArray[columnCounter + 3] && squareArray[columnCounter + 3] == squareArray[columnCounter + 6])            {                playerWin = player;            }        }        //Tests both diagnols        if(squareArray[0] == squareArray[4] && squareArray[4] == squareArray[8])        {            playerWin = player;        }        else if(squareArray[2] == squareArray[4] && squareArray[4] == squareArray[6])        {            playerWin = player;        }        //Checks for Tie        if(moveCounter == 9 && playerWin != player)        {            playerWin = 't';        }        if(playerWin == player)        {            std::cout << std::endl << Congratulations player  << player << ! You Win! << std::endl;        }        else if(playerWin == 't')        {            std::cout << Tie!  You should play again to settle the duel! << std::endl;        }    }    return(playerWin);}char TicTacToe::togglePlayer(char player){    player = player == 'X' ? 'O':'X';    return(player);}
TicTacToe Implemented with classes
c++;tic tac toe
File NamesFile names usually don't include the 'class' postfix, you just name the file after the class contained, i.e. 'TickTackToe.h', not 'TickTackToeClass.h'.Classless FunctionsYou wouldn't usually have non-class functions, possibly unless they are friend functions, in the implementation file for the class.  So, getUserWantsToPlay should be moved.BugWhen checking for row wins, should be incrementing rowCounter by 3, not by 2for(int rowCounter = 0; rowCounter < 8; rowCounter+=3)StructureWith your current code, it feels like the main method has too much of an orchestration role for your class.  If the methods are called out of order, or the wrong player is passed in, then the game wouldn't function as expected.  One way to get around this is to make a lot of the methods private expose only methods that a client would need to call as public.I'd also suggest introducing some helper methods to the class to help reduce some of it's complexity and make it easier to follow the logic.  You may also want to consider adding some constants for some of the magic numbers (such as 5 for minimum moves needed before you need to check for a winner.To help illustrate some of the above, I've done some refactoring on your code (below).  This isn't a complete job, just moves it a couple of steps forward.Main.cpp#include TicTacToe.hbool getUserWantToPlay();int main(){    //Assumes no play unless user decides they want to play and initializes game variable to TicTacToe class    bool play = false;    //allows for multiple games to be played    while (getUserWantToPlay())    {        TicTacToe game;        game.playGame();    }    return(0);}bool getUserWantToPlay(){    char response;    bool invalidResponse = true;    bool play = false;    while (invalidResponse == true)    {        std::cout << Would you like to play a new game of TicTacToe? (y/n)  << std::endl;        std::cin >> response;        if (response == 'y')        {            invalidResponse = false;            play = true;        }        else if (response == 'n')        {            std::cout << No Problem!;            invalidResponse = false;        }        else        {            std::cout << Please input a proper response (y/n) << std::endl;        }    }    return play;}TickTackToe.h#ifndef TICTACTOE_H_#define TICTACTOE_H_class TicTacToe{public:    TicTacToe();    void playGame();private:    void drawBoard();    void getPlayerMove(char player);    char togglePlayer(char player);    bool checkForWin(char player);    bool checkLineForWin(int square1, int square2, int square3, char player);    bool checkForTie();    char squareArray[9];    int moveCounter;};#endif /* TICTACTOE_H_ */TicTacToe.cpp#include TicTacToe.hstatic const int MinMovesNeededToWin = 5;static const int MaxMovesInGame = 9;TicTacToe::TicTacToe()    : squareArray{ '1','2','3','4','5','6','7','8','9' },    moveCounter(0){}void TicTacToe::drawBoard(){    //draws the game board with updated characters for each player    std::cout << Player 1 (X) - Player 2 (O) << std::endl << std::endl << std::endl;    std::cout <<     |     | << std::endl;    std::cout <<   << squareArray[0] <<   |   << squareArray[1] <<   |   << squareArray[2] << std::endl;    std::cout << ____|_____|____ << std::endl;    std::cout <<     |     |     << std::endl;    std::cout <<   << squareArray[3] <<   |   << squareArray[4] <<   |   << squareArray[5] << std::endl;    std::cout << ____|_____|____ << std::endl;    std::cout <<     |     |     << std::endl;    std::cout <<   << squareArray[6] <<   |   << squareArray[7] <<   |   << squareArray[8] << std::endl;}void TicTacToe::getPlayerMove(char player){    //Gets player move and stores in board array for display through next iteration    bool playerMoveFound = false;    char playerTurn = '0';    char playerMove = '0';    if (player == 'X')    {        playerTurn = '1';    }    else    {        playerTurn = '2';    }    while (playerMoveFound == false)    {        std::cout << Player  << playerTurn <<  please make a move << std::endl;        std::cin >> playerMove;        for (int counter = 0; counter < 9; counter++)        {            //If finds the array number makes the change to the iteration...prevents x or o movement            if (playerMove == squareArray[counter] && playerMove != 'X' && playerMove != 'O')            {                squareArray[counter] = player;                playerMoveFound = true;                //Move counter implemented to streamline check for win/check for tie                moveCounter++;            }        }        if (playerMoveFound == false)        {            std::cout << Invalid player move... << std::endl;        }    }}bool TicTacToe::checkLineForWin(int square1, int square2, int square3, char player) {    return squareArray[square1] == player &&           squareArray[square2] == player &&           squareArray[square3] == player;}bool TicTacToe::checkForWin(char player){    bool playerWin = false;    if (moveCounter >= MinMovesNeededToWin)    {        // Only need to check for current player        // Only need to check until we have a win        for (int rowCounter = 0; !playerWin && rowCounter < 8; rowCounter += 3)        {                       playerWin = checkLineForWin(rowCounter, rowCounter + 1, rowCounter + 2, player);        }        //Tests columns for win        for (int columnCounter = 0; !playerWin && columnCounter < 3; columnCounter++)        {            playerWin = checkLineForWin(columnCounter, columnCounter + 3, columnCounter + 6, player);        }        //Tests both diagnols        playerWin |= (checkLineForWin(0, 4, 8, player) | checkLineForWin(2, 4, 6, player));    }    return playerWin;}bool TicTacToe::checkForTie() {    return moveCounter == MaxMovesInGame;}void TicTacToe::playGame() {    char playerWinner = 'n';    char player = 'X';    bool gameOver = false;    //single game iteration    do{        drawBoard();        getPlayerMove(player);        if (checkForWin(player)) {            std::cout << std::endl << Congratulations player  << player << ! You Win! << std::endl;            gameOver = true;        } else  if (checkForTie()) {            std::cout << Tie!  You should play again to settle the duel! << std::endl;            gameOver = true;        }        player = togglePlayer(player);    } while (!gameOver);    drawBoard();}char TicTacToe::togglePlayer(char player){    player = player == 'X' ? 'O' : 'X';    return(player);}Next StepsAs for next steps, you might want to consider the community challenge, which this month is snakes and ladders.  If you extend it to make it playable it should give a few options for creating classes that interact with each other.  There have been a few different submissions including one in C++.