C + + assignment to a program? This is my assignment for class not sure how to start it. Can someone give me some ideas?
Simulation Super LOTTO
The "heart and guts" of any game is the random number generator.
Using chance to write a simulation that "play" California Super Lotto. Your program logic will allow the player to:
1) Choose any integer from 1 6-55. Your logic should prevent the player from selecting a less value than 1 or greater than 55. The logic should prevent the player from selecting the same number (ie they can not have two or more of their selections to be the same number).
2) display selections of players number 6 on the CRT screen.
3) Use the built in function rand hit 6 numbers. These simulation "balls" to be chosen by LOTTO ball (ie = rand ()% max_num + 1;). You will also need to set the seed for the algorithm of random numbers:
srand ((unsigned) time (NULL));
4) Determine the number of "hits" (these figures that the player chooses which corresponds to those who had LOTTO).
5) If you match 0, 1 or 2 numbers, you earn NO money (but print messages such as "WIN our schools.").
6) We will move from a Mega number. You probably want to put the logic in some sort of loop to ask the user if he wants to play again (clearing the previous variables and tables?)
aec If you match three numbers, you win $ 5.00.
aec If you have 4 numbers, you win $ 36.00.
aec If you match 5 numbers, you win $ 1,000.00 to $ 25,000.00 dollars (ie, random (25) + 1).
aec If you match 6 numbers (none of them the bonus) you win $ 1 million to $ 100 million (ie, random (100)).
Tips tactical
1. Use a pair of one-dimensional arrays of size 56. We "ignore" index 0, leaving 1-55. A matrix of "keep" the player chooses six numbers. The other table holds "the lotto numbers attracted. All the values of spot array of arrays to 0. Set the value of the location of a field on the location of the index to 1 if the player selected the numbers (ie, they picked up 2, so the location index array index 2 value 1). Define the location of the other picture of the value to 1 if that number has LOTTO.
2. Compare the two tables to determine if a match has occurred. If the same site index on both tables holds a 1, a match has occurred. Use loops to search through the tables.
3. Use a switch statement to determine the prize based on the number of matches. The number of matches is an integer.
4. There is a more "difficult" to do so with an array of 6 numbers each (using two tables size 56 is "straight ahead, the brute force approach, without finesse, the method easier to understand).
It is an exercise in logic.
I'm not really sure what you are saying. I think your instructor has given you great advice. They even went so far as to tell you where to use for loops and switch statements. Your program seems to be described very well already.
Posted on April 9, 2010.