I need to return the numbers of the lotto ticket to main, then call a print() to print the numbers. But the ticketGenerator only returns 1 number. Please help

#include <iostream>
#include <ctime>
using namespace std;
int ticketGenerator(int);
void printTicket(int,int);
int main()
{
	int size;
	int numbers;
	cout << "How many number of tickets do you want? ";
	cin >> size;
	while ( size < 1 || size > 30 )
	{
		cout << "Max number of tickets allowed is 30" << endl
			  << "How many number of tickets do you want? ";
		cin >> size;
	}
	for ( int i = 0; i < size; i++ )
	{
		numbers = ticketGenerator(size);
		printTicket(size,numbers);
	}
	return 0;
}
int ticketGenerator( int size )
{
	int lines[ 30 ] [ 10 ] [ 6 ];
	//srand( time( 0 ) );
	for ( int i = 0; i < size; i++ )
	{
		for ( int j = 0; j < 10; j++ )
		{
			for ( int k = 0; k < 6; k++ )
			{
				lines [ i ] [ j ] [ k ] = 1 + rand() % 40;
				for ( int m = 0; m < k; m++ )
				{
					if ( lines [ i ] [ j ] [ m ] == lines [ i ] [ j ] [ k ] )
					{
						lines [ i ] [ j ] [ k ] = 1 + rand() % 40;
					}
				}
				return lines [ i ] [ j ] [ k ];
			}
		}
	 }

}
void printTicket( int size, int numbers )
{
	for ( int i = 0; i < size; i++ )
	{
		for ( int j = 0; j < 10; j++ )
		{
			for ( int k = 0; k < 6; k++ )
			{
				cout << numbers << " ";
			}
			cout << endl << endl;
		}
		cout << endl << endl << endl << endl;
	}
}

that is because you are only returning an int. It seems like you wish to return the whole array. try changing the return type to either an int *** or int [30][10][]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.