Quick Question on most efficient way to store multiple integer values for a baseball game

For my intro to c++ class, we have to write a baseball game as our final project. Its pretty basic and I have a good idea on how I am going to do everything except I have one problem. We have to keep all the stats of each player on the two teams such as how many hits they had, how many times they got to first, second third etc. What would the easiest way to keep all of this data together in terms of associating it with each player. So for example if player1 has 3 hits, whats the best way to ensure that this is continuous through the rest of the game and that it doesnt get mixed up with player2. Would using parallel arrays/vectors be efficient? I am sorry if this is confusing but I have a lot of thoughts going through my mind and I typed it all out pretty quickly.

Use a class or struct to store each player and a vector to store the players.
I agree with integralfx. For example:
1
2
3
4
5
6
7
8
9
10
11
12
13
class Player;
class BaseballGame {
  ...
private:
  vector<Player*> m_players;
};

class Player {
  ...
private:
  int m_nHits;
}
Topic archived. No new replies allowed.