# Beginner needs help w/ran. nums. in arrays - URGENT!

• 12-11-2001
Beginner needs help w/ran. nums. in arrays - URGENT!
I need to create a program that generates 50 sets of lotto picks each set consisting of 6 numbers between 1 - 54. each set must contain 6 unique numbers. The set themselves do not need to be unique from each other. That is the question - the problem is that when I run the program all I get is what looks like a memory adddress ( 006AF948).
Any help would be greatly appreciated as my instructor didn't get back to me with this assignment till Monday and it is due Wed. The program is as follows. If I am understanding 2D arrays (probably not ;( ) would what I have not put a random number in each element? Thanks for any and all help.

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <ctime>
using namespace std;

int main()
{
//declare array
int lottoNums[50][6] = {0};

//declare variables
int row = 0;
int col = 0;
int number = 0;

//initialize the random number generator
srand(time(NULL));

//generate random numbers
number = 1 + rand() % (54 - 1 + 1);

while (row < 50)
{
col = 0;
while (col < 6)
{
lottoNums[row][col] = number;
col = col + 1;
}//end while
row = row + 1;
}//end while

//display lottery numbers
cout << "Here are your 50 sets of lotto picks:" << endl;
cout << lottoNums;

return 0;
}//end of main function
• 12-11-2001
gliptic
It's not so strange since you are writing out the address of the lottoNums array.
• 12-12-2001