I'm creating a lottery game that solicits 6 numbers from the user between 1-59 and then generates 6 numbers until they all match. When I compile and run my code it takes the user input fine. However as it runs through i want it to display what number its on and then keep going until it finds a match to the numbers. However when i do run it the code is just a line of long numbers and thats it. Any suggestions?

Code:#include "stdafx.h" #include <iostream> #include <ctime> #include <string> using namespace std; void getnums(int[]); int main() { srand((unsigned) time(0)); const int MAXNUM = 6; int count = 1; int total = 0; int x, n, nums[MAXNUM]; int lotnums[MAXNUM]; for(x=0;x<MAXNUM;x++) { cout << "\nPlease enter number " << x+1 << " : " ; cin >> nums[x]; if ((nums[x] > 59) || (nums[x] < 1)) { cout << "\nThat is not a valid entry." << endl; x=x-1; } } getnums(lotnums); for (x=0;x<MAXNUM;x++) for (n=0;n<MAXNUM;n++) if (lotnums[x]==nums[n]) { cout << nums[0] << " " << nums[1] << " " << nums[2] << " " << nums[3] << " " << nums[4] << " " << nums[5] << endl << endl; cout << lotnums[0] << " " << lotnums[1] << " " << lotnums[2] << " " << lotnums[3] << " " << lotnums[4] << " " << lotnums[5] << endl << endl; cout << "/n/n Congratulations you just won the lotttery. It took " << total << " attempts." << endl << endl; } else if (lotnums[x]!=nums[n]) { getnums(lotnums); total+=count; cout << total; } return 0; } void getnums(int lotnums[]) { lotnums[0] = 1 + rand() % 59; do lotnums[1] = 1 + rand() % 59; while (lotnums[0] == lotnums[1]); do lotnums[2] = 1 + rand() % 59; while ((lotnums[0] == lotnums[2]) || (lotnums[1] == lotnums[2])); do lotnums[3] = 1 + rand() % 59; while ((lotnums[0] == lotnums[3]) || (lotnums[1] == lotnums[3]) || (lotnums[2] == lotnums[3])); do lotnums[4] = 1 + rand() % 59; while ((lotnums[0] == lotnums[4]) || (lotnums[1] == lotnums[4]) || (lotnums[2] == lotnums[4]) || (lotnums[3] == lotnums[4])); do lotnums[5] = 1 + rand() % 59; while ((lotnums[0] == lotnums[5]) || (lotnums[1] == lotnums[5]) || (lotnums[2] == lotnums[5]) || (lotnums[3] == lotnums[5]) || (lotnums[4] == lotnums[5])); return; }