This is a mastermind game. I was trying to make sure that my twoD array was beinga ssigned right by printing it out real quick before i use it to draw a board in the console. For some reason im gettin these errors and i dont even have a clue how to fix it. Help please

Code:

#include <iostream>
#include <iomanip>
#include <ctime> // For time()
#include <cstdlib> // For srand() and rand()

using namespace std;


int rowCounter = 0;
int colCounter = 0;
char twoDArray[8][4];
const int guess_rows = 8;
const int guess_cols = 4;

int *getRandomNumbers(int);
char setColor(int num);
void promptUser(char guess[4], int n);
bool endGame(char guess[4], char answer[]);
void copyToTwoDArray(char guess[4], char twoDArray[8][4],int n);
void showArray(char [][guess_cols], int );




int main()
{
	
	char guess[4];
	char answer[4];
	char playAgain = 'Y';
	bool success;
	bool win;
	int guesses;
	char vote;
	int *numbers;

	do
	{

		success = false;
		guesses = 0;

		cout << endl;
		numbers = getRandomNumbers(4);

		for(int count = 0; count < 4; count++)
		{
			cout << numbers[count] << endl;
			answer[count] = setColor(numbers[count]);
			cout << answer[count] << endl;

		}
		cout << endl;


		while (!success && guesses < 9)
		{
			promptUser(guess, guesses);
			copyToTwoDArray(guess,twoDArray, guesses);
			success = endGame(guess, answer);
			guesses++;
		}

		

		if(success)
		{
			cout << "You guessed the correct answer" << endl;
			cout << "The correct answer was: " << answer[0] << answer[1] << answer[2] << answer[3] << endl;


		}
		else
		{
			cout << "Sorry!!! The correct answers were: " << answer[0] << answer[1] << answer[2] << answer[3] << endl;

		}

		cout << "Play agains? (Y or N): ";
		cin >> playAgain;


	}
	while( (playAgain == 'Y' || playAgain == 'y' ));


	return 0;
}

void showArray(int array[][guess_cols], int rows)
{
	for(int x = 0; x < rows; x++)
	{
		for(int y = 0; y < guess_cols; y++)
		{
			cout << setw(4) << array[x][y] << " ";
		}
		cout << endl;
	}
}

void copyToTwoDArray(char guess[4], char twoDArray[8][4], int n)
{
	if(n = 0)
	{
		for(int counter = 0; counter < 4; counter ++)
		{
			guess[counter] == twoDArray[0][counter];
		}
	}

	if(n = 1)
	{
		for(int counter = 0; counter < 4; counter ++)
		{
			guess[counter] == twoDArray[1][counter];
		}
	}

	if(n = 2)
	{
		for(int counter = 0; counter < 4; counter ++)
		{
			guess[counter] == twoDArray[2][counter];
		}
	}

	if(n = 3)
	{
		for(int counter = 0; counter < 4; counter ++)
		{
			guess[counter] == twoDArray[3][counter];
		}
	}

	if(n = 4)
	{
		for(int counter = 0; counter < 4; counter ++)
		{
			guess[counter] == twoDArray[4][counter];
		}
	}

	if(n = 5)
	{
		for(int counter = 0; counter < 4; counter ++)
		{
			guess[counter] == twoDArray[5][counter];
		}
	}

	if(n = 6)
	{
		for(int counter = 0; counter < 4; counter ++)
		{
			guess[counter] == twoDArray[6][counter];
		}
	}

	if(n = 7)
	{
		for(int counter = 0; counter < 4; counter ++)
		{
			guess[counter] == twoDArray[7][counter];
		}
	}

	if(n = 8)
	{
		for(int counter = 0; counter < 4; counter ++)
		{
			guess[counter] == twoDArray[8][counter];
		}
	}

	


}

void promptUser(char guess[4], int n) // function for generating guesses from the user
{
	

	cout << "Please enter a guess number "<< (n + 1) << ": ";

	cin >> guess[0] >> guess[1] >> guess[2] >> guess[3];

	
	

	for(int count = 0; count < 4; count++)
	{
		if(guess[count] > 91)
			guess[count] = guess[count] - 32;
		

	}

	cout << guess[0] << guess[1] << guess[2] << guess[3] << endl;

	showArray(twoDArray,guess_rows);
	

}

bool endGame(char guess[4], char answer[]) // function for testing whether or not game is over
{
	int totalCorrect = 0;
	int correctColor = 0;
	bool status = false;

	if(guess[0] == answer[1] || guess [0] == answer [2] || guess [0] == answer[3])
	{
		// insert an x
		totalCorrect++;

	}
	else
	{
		//insert a dash
	}
	if(guess[1] == answer[0] || guess [1] == answer [2] || guess [1] == answer[3])
	{
		// insert an x
		totalCorrect++;

	}
	else
	{
		//insert a dash
	}
	if(guess[2] == answer[1] || guess [2] == answer [0] || guess [2] == answer[3])
	{
		// insert an x
		totalCorrect++;

	}
	else
	{
		//insert a dash
	}
	if(guess[3] == answer[1] || guess [3] == answer [2] || guess [3] == answer[0])
	{
		// insert an x
		totalCorrect++;

	}
	else
	{
		//insert a dash
	}
	
	for(int i = 0; i < 4; i++)
	{

		if(guess[i] == answer[i])
		correctColor++;

	}
	if (correctColor == 4)
	{
		status = true;

	}
	

	cout << "Number of correct color and position: " << correctColor << endl;
	cout << "Number of correct color only: " << totalCorrect << endl;

	return status;
}


char setColor(int num) // function for converting the int from random generator to char
{
	if (num > 0 && num < 18)
	{
		return static_cast<char>(82);
	}
	else if ( num >= 18 && num < 35)
	{
		return static_cast<char>(79);
	}
	else if ( num >= 35 && num < 52)
	{
		return static_cast<char>(89);
	}
	else if ( num >= 52 && num < 69)
	{
		return static_cast<char>(71);
	}
	else if ( num >= 69 && num < 86)
	{
		return static_cast<char>(66);
	}
	else if ( num >= 86 && num <= 100)
	{
		return static_cast<char>(86);
	}

}


int *getRandomNumbers(int num) // function for generating a random number
{
	int *arr;
	

	if (num <= 0)
		return NULL;

	arr = new int[num];

	srand((unsigned int) time(0) );
	
	for (int count = 0; count < num; count++)
	{
		arr[count] = (rand()% 100) + 1;
	}

	return arr;
}

error messages:
Error 12 error LNK2001: unresolved external symbol "void __cdecl showArray(char (* const)[4],int)" (?showArray@@YAXQAY03DH@Z) MidtermMastermind.obj
Error 13 fatal error LNK1120: 1 unresolved externals C:\Users\Chris\Documents\Visual Studio 2008\Projects\ChrisCaldwell_Midterm_MasterMind\Release\MatermindGame.exe

void __cdecl showArray(char (* const)[4],int)

needs a definition, even if it's empty--then it will compile properly.

Your prototype (declaration) differs in parameter type: void showArray(char [][guess_cols], int );

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.