Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This assignment has to be assembly language and using the Irvine32 library. You

ID: 3577610 • Letter: T

Question

This assignment has to be assembly language and using the Irvine32 library.

You need to create a lottery simulator. The program must allow the user to enter the starting value, the ending value, and the number of times to generate a random number. The program should store the inputs in variables and use them in the program.  

Requirements:

Display input messages to get the starting value, ending value, and number of times to generate a number.

Use a LOOP instruction to generate a random number between the start and end values and display the randomly generated number.

The program should display the lottery number generated for each loop iteration. For example, the user wants to run the lottery 100 times with the starting value of 1 and the ending value of 999 where each time the lottery generates a number it gets displayed on the screen.

Change the color of the background and text for your program using the Irvine Library function.

Explanation / Answer

const int lotteryDigits = 10; const int SIZE = 5; //======================================================================================= // Function Prototypes // ------------------- int generateLottery(int[], int, int); int userInput(int[], int); int matchCounter(int[], int[], int); void displayNumbers(int[], int[]); void winnerOrLoser(int); //======================================================================================= // ------------- // Main Function // ------------- //======================================================================================= using namespace std; int main() { // Variable Declarations int lottery[5] = {0, 0, 0, 0, 0}; int user[5] = {0, 0, 0, 0, 0}; int matches = 0; //Function Calls generateLottery(lottery, SIZE, lotteryDigits); userInput(user, SIZE); matchCounter(lottery, user, matches); displayNumbers(lottery, user); winnerOrLoser(matches); system("pause"); return 0; } //end main //======================================================================================= // -------------------- // Function Definitions // -------------------- //======================================================================================= // Randomly generates winning lottery numbers int generateLottery(int lottery[], int, int) { unsigned seed = time(0); srand(seed); for (int y=0; y> user[y]; } } return user[0], user[1], user[2], user[3], user[4]; } // end userInput //======================================================================================= // Counts the number of matches int matchCounter(int lotto[], int input[], int) { int match = 0; for (int x = 0; x