function won't print my array?

Hi guys,
I am new to c++ but I have an issue with my program.
basically I have a blackjack program (that I think everyone starts with?) and I am trying to test my randomly filled array by printing the whole thing, rows and columns.
however, when I run the function I have it doesn't print anything. could someone give me a hand to tell me what I'm doing wrong?


1
2
3
4
5
6
7
8
9
10
11
12
void fill(int i, int j, int cCardDeck[4][14]) //intialize array with random numbers
	{
		srand(time(NULL));
			for (i=0; i<4; i++)
			{	
				for (int j=0; j<14; j++)
				{	
					cCardDeck[i][j] = rand() % 14; 
				}  
			}
void print();
};

This is the print function


1
2
3
4
5
6
7
8
9
10
11
void print(int i, int j, int cCardDeck[4][14]) //print array to test in rows and columns
{
    for (int i = 0; i < 4; ++i)
    {
        for (int j = 0; j < 14; ++j)
        {
            cout << cCardDeck[i][j] << ' ';
        }
        cout << endl;
    }
}


any and all help is much appreciated. I feel like im so close but missing one silly thing.
line 11 - when you call a function, you don't need the return type.

You've defined the print function to take parameters, but the call on line 11 doesn't include any.

void print(int i, int j, int cCardDeck[4][14])
Removing the parameters gave me errors before, but now apparently i fixed whatever really was causing the errors.
however now I have adjusted to this and it still doesnt print.
This is my full code. pardon the mess, the professor has declared what the variables should be called.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Programmer:	(Ian Dalton)

// Course:	COMP220

// Assignment:	Two-Dimensional Arrays

// Description: The program will use a 2D array and a random-number 
// generation to play Blackjack and keep track of a playing-card deck.

// Input: User data entry and a playing-card deck represented as a two-
// dimensional array

// Output: A screen display showing the current card hands of each player
// and the dealer, their score, win and lose status, and a final representation
// of the card deck after the game is over

#include<iostream>
#include<iomanip>
#include<windows.h>


using namespace std;

char cPlay;				//answer to yes or no (wanna play?)
int iPlayerCount;		//self explanatory
int cCardDeck[4][14];	//array representing the card deck
//int iCard;				//Card array index
int iNumberOfDraws = 0; //Number of rounds of card draws
//int iSuit;			//Suit array index
//0 = diamonds		//declare which suit the card has, eventually
//1 = hearts
//2 = clubs
//3 = spades

int iNumberOfPlayers = 0;	//Number of players in current game
//ignore this stuff until these variables are needed
/**int iPlayerCount[5];		//Integer array to holder each player's count
							//iPlayer[0] is always the dealer
int iHighestCount = 0;		//Highest count for a single game
int k, m;					//integer loop counters
srand(GetTickCount());		//Seed the random-number generator
**/
//main loop (play?)
int main()
{ 
	cout << "Wanna play a game of Blackjack? Y/N" << endl;
	cin  >> cPlay;

	if ( (cPlay == 'y') || (cPlay == 'Y') )
		{
		
		cout << "Great! How many people are playing?" << endl;
		cin  >> iNumberOfPlayers;
		cout << "Excellent. Let me deal for the ";
		cout << iNumberOfPlayers;
		cout << " of you" << endl;
		void fill();
		}
	else 
	{
		cout << "Then why did you open this, ya goof? See you later!" << endl;

	system ("PAUSE");
	}

		system ("PAUSE");

}

void print()
{
    for (int i = 0; i < 4; ++i)
    {
        for (int j = 0; j < 14; ++j)
        {
            cout << cCardDeck[i][j] << ' ';
        }
        cout << endl;
    }
}

void fill() 
	{int i;
		
			for (i=0; i<4; i++)
			{	
				for (int j=0; j<14; j++)
				{	
					cCardDeck[i][j] = j; 
				}  
			}
print();
}
line 57 - remove the return type in the function call

if you're going to have function definitions after the main function where they're called, there should be a function prototype before main so the compiler knows what they are

//function prototypes
void print();
void fill();

//main function
int main()
That did it! thanks so much for your help!!
Topic archived. No new replies allowed.