Is there a way to make a loop that creates strings? I ask the user how many players there are, and then the loop makes that many strings in order to get all of their names... Something like this, (but not in normal english...):

cout << "How many players? " << endl;
cin >> numOfPlayers;
 
for(unsigned int i=0 ; i<numOfPlayers ; i++)
     {
     /* create new string */
     }

And then, if that's possible, how could I access each one individually?

you will want to create an array, or vector, of strings.

vector<string> names;
<snip>
for(unsigned int i=0 ; i<numOfPlayers ; i++)
     {
           string name;
           cout << "Enter name #" << i << "\n";
           getline(name, cin);
           names.push_back(name);
     }

>>how could I access each one individually?
From the above vector: if n is an integer between 0 and the number of names in the array

string thisName = names[n];

There is another way to access individual members of a vector - using an interator -- but its a little more complex.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.