Hello, i was asked to do a lottery program.
So far i only learnt IF/ELSE, Switch Case, For/While/Do While and now Random. Since this is on the Random papper my teacher gave me i'm guessing that it is a requirement. Lottery here in my country works this way:
5 numbers are chosen between 1-50(where numbers are not repeated);
2 stars are chosen between 1-12(where numbers are not repeated);
Prizes are higher accordingly to how many numbers and stars were correct.
i understand that, but i cannot use what i have not yet learned, so i think that arrays are out of the question.
Is there a way for me to run the random code 5 times and each time it removes the numbers that was picked randomly before? This way they dont pick the same number again.
i understand that, but i cannot use what i have not yet learned, so i think that arrays are out of the question.
I tell you what, @HDinis09, since you came to this site why don't you learn about arrays here: http://www.cplusplus.com/doc/tutorial/arrays/
Then, when you've learnt about arrays they won't be out of the question anymore, will they?
I tell you what, @HDinis09, since you came to this site why don't you learn about arrays here: http://www.cplusplus.com/doc/tutorial/arrays/
Then, when you've learnt about arrays they won't be out of the question anymore, will they?
I have already learnt about them both in that tutorial and 2 other youtube videos and it just works beautifully, but i can't use them in this case, since i cannot use what i have not learnt in class, that is the only thing really.
Does your assignment actually state that you can't use arrays?
You can choose to call your selections number1, number2, number3, number4, number5 if you choose, but I think the rest of us would use arrays or some other sort of container.
Why don't you ASK your teacher whether a particular feature is legitimate or not? If you are going to class (which I hope) ... then ask him/her there. Alternatively, send him/her an email. Academic staff won't bite you. Promise!