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.
Last edited by Ancient Dragon; Jun 6th, 2007 at 11:27 pm.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Offline 21,961 posts
since Aug 2005