Purpose: To write nested iterator (for loop) statements. To use the C standard library and call the srand and rand functions. In general this program is to assemble different programs into one whole program. Specifically this program will assemble program 4-11 and Program 6-5 to generate a list of lucky lottery numbers.
General information:
You want to make money from a state lottery. The only sure bet is to sell lucky lottery numbers at price of one dollar for four picks in the state lottery. The lottery consists of picking five numbers where each number is an integer from 1 to 60.
Disclaimer: This program is NOT designed to get you to play the lottery. This program is for educational purposes only and is intended to teach how to incorporate two existing programs into one program. Any chance that the numbers generated from the program winning an actual state lottery is pure chance.
Use the srand function with the seed number 835
Use the rand function and the information from program 4-11 to generate random numbers in the range from 1 to 60.
On each line, put 5 random numbers
Write 4 lines of 5 random numbers.
Example of the output:
99 lucky Neil Miserendino
Your lucky pick 1: 18 23 17 47 3
Your lucky pick 2: 53 12 16 49 2
Your lucky pick 3: 4 59 5 8 34
Your lucky pick 4: 34 34 18 25 1
Other information:
Add the following preprocessor directive to your program:
#include < stdlib.h> // standard library which has the random function
Inside the main part of the program after this print statement:
printf("your_number lucky_your_name(backslash)n");
// use this line of code to "seed" the random numbers
srand(835);
// code MODIFIED from program 6-5 combined with program 4-11 goes below here
Homework objective: Writes the pseudo code (the steps) to find a number in a list of numbers. About half of those steps are written below. You need to write the remaining steps.
1. Declare an array of integers and other variables as needed.
2. Print my folder number key word and name
3. Call the function srand to “seed” the random number generator
4. Using an iterator statement (a “for” loop), call the random function to generate random numbers and put the numbers in the array.
5. Ask the user to guess one number on the list
6. Use the scanf function to put the guess into the program
7. “Echo” print the user’s number.