My code isn't out putting when someone wins even though they get 3 in a row. I think there is something wrong with my function bool hasWon(string boardPos[]);. I'm new to c++, so i would appericate if someone would help with this.
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
bool hasWon(string boardPos[]);
void turn(int player, string boardPos[]);
void printGame(string boardPos[], int size, string name1, string name2);
int main()
{
string boardPos[9]= {"1", "2", "3", "4", "5", "6", "7", "8" ,"9"}; //initialize array with preset values
int size = 9; //initialize size of array
int count= 0;
string player1, player2; //initializing variables
cout<<"Enter your player names."<<endl; //prompts users for player names
cout<<"Player 1: ";
cin>>player1; //user input
cout<<"Player 2: ";
cin>>player2;
cout<<"Choose a position on the board from 1-9"<<endl; //prompts user for position on board
system("cls"); //clears previous clutter
printGame(boardPos, size, player1, player2); //prints a blank board
while((count<=9) && !hasWon(boardPos)) //while board is not full or a player has not won
{
cout<<player1<<": ";
turn(1, boardPos);
cout<<endl;
system("cls");
printGame(boardPos, size, player1, player2);
count++;