Structure within a class

I'm trying to create a class called "team" that has a structure called "player" as one of its members. There will many players so I'm also creating an array called "totalplayers" which has a value of 100. This is where I'm getting an error. Can someone tell me why my last line of code below is wrong? I also tried the format team.player totalplayers[maxplayers] in the last line but that didn't work either.

More broadly, what is the best way to create an array of structures within a class? I am a newbie so this may be straightforward but I've never done it before.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

class team {
public:
	int teamNumber;
	string name;
	int currentPlayerCount;
	int budget;
	float powerRank;
	
	struct player {
	int rank;
	string name;
	string position;
	string state;
	string height;
	int weight;
	string school;
	float forty_time;
	int bench;
	float visitScore;
	
	
};
	

	}; 

const int maxplayers = 100;
player totalplayers[maxplayers];


It is team::player totalplayers[maxplayers];
Topic archived. No new replies allowed.