I'm a little lost

I'm a beginner in programming and I have started a program for my game but I'm stuck here's the code I'm at so far.
void View::newGame() {


string players[MAX_PLAYERS];


int numberPlayers = inputName(players);

cout << "This will be a " << numberPlayers << "-Players game." << endl;

}

int View::inputName(string players[]) {



int numberPlayers = 0;



for (int index = 0; index < MAX_PLAYERS; index++) {



cout << "Enter a player name " << endl;

getline(cin, players[index]);

numberPlayers++;

" if (index > 0){

if (players[index] == ' '){

}

}"
}
return numberPlayers;

}

What I put in quotes is where I am stuck and I know its wrong but I cant figure out how to fix it.

I don't get how to make the game know that pressing enter or a blank spot
is invalid. Please someone help me.

(even if its an easy solution I don't really know the exact terms for what I
need to do or what I did wrong so if possible can someone also explain what I need to do)
Topic archived. No new replies allowed.