Lottery Lab

I am working on my set/multisets lab for school. The lab that I am working on is a Lottery lab. My instructor said he created his contestants objects that have a vector of their ticket numbers. For example an individual object has a vector that holds 5 ints. But I am bit confused on how he is doing this. I believe that the vector for each object when generated is being done so as a class member function. So I don't think he is doing something like:

1
2
3
4
  Contestant::Contestant()
{
vector<int> TicketNumbers;
}


Could anyone possibly help me with some ideas on how to do this. Some examples would be great.
i don't get your question....
For the lab I need to randomly generate x amount of contestants. I have a class for my contestants and for each of the contestant objects they each will have a vector to hold their 5 ticket numbers. I hope this helps out.
Oh but too help, what I seem to be having an issue with is how to create an object that has a vector.
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
33
34
35
36
37
38
39
40
41
42
#include <iostream>
#include <vector>

class Contestant
{
public:
	void addNumber(int num)
	{
		m_ticketNumbers.push_back(num);
	}

	void displayNumbers()
	{
		for (size_t i = 0; i < m_ticketNumbers.size(); ++i)
		{
			std::cout << m_ticketNumbers.at(i) << std::endl;
		}
	}

	// remove, clear, etc. 

private:
	std::vector<int> m_ticketNumbers;
};


int main()
{
	Contestant contestant;

	contestant.addNumber(53);
	contestant.addNumber(21);
	contestant.addNumber(12);
	contestant.addNumber(245);
	contestant.addNumber(65);
	contestant.addNumber(1);

	contestant.displayNumbers();


	return 0;
}
Topic archived. No new replies allowed.