String Array Initialization Problem

I'm attempting to make a program to help my friends and I make a draft system (NBA draft for example), but I ran across an issue with the creation of the string type array "listOfPlayers". Help as to why this happened would be much appreciated.

1
2
3
4
5
6
7
 int numOfPlayers;

cout << "Inputer the # of players in this draft: ";
cin >> numOfPlayers;
cout << endl << endl;

string listOfPlayers [numOfPlayers];
When declaring array's, your size must be a constant. One thing you could do is use a vector of strings.

std::vector<std::string> listOfPlayers(numOfPlayers);

Including <vector> to use a vector.
Thank you!
Topic archived. No new replies allowed.