Tic Tac Toe Trouble

I'm working on a tic tac toe board and am having difficulty displaying it correctly.

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

/**********************************************************************
* Add text here to describe what the function "main" does. Also don't forget
* to fill this out with meaningful text or YOU WILL LOSE POINTS.
***********************************************************************/
void getFileName(char fileName[])
{
cout << "Enter source filename: ";
cin >> fileName;

}

void readFileName(char fileName[], char ticTacToe[][3])
{

ifstream fin(fileName);
if (fin.fail())
return;
for (int row = 0; row < 3; row++)
{
for (int col = 0; col < 3; col++)
{
fin >> ticTacToe[row][col];
}
}
fin.close();
return;

}

void readFileName2()
{
char desFileName;
cin >> desFileName;
}


int main()
{
char fileName[256];
char ticTacToe[3][3];
getFileName(fileName);
readFileName(fileName, ticTacToe);
for (int row = 0; row < 3; row++)
{
for (int col; col < 3; col++)
{
if (ticTacToe[row][col] == '.')
cout << " ";
else if (ticTacToe[row][col] == 'X')
cout << 'X';
else if (ticTacToe[row][col] == 'O')
cout << 'O';
else
cout << ticTacToe[row][col];

cout << ticTacToe[0][0] << " | "
<< ticTacToe[0][1] << " | "
<< ticTacToe[0][2] << " \n"
<< "---+---+---\n"
<< " " << ticTacToe[1][0] << " |"
<< " " << ticTacToe[1][1] << " |"
<< " " << ticTacToe[1][2] << " \n"
<< "---+---+---\n"
<< " " << ticTacToe[2][0] << " |"
<< " " << ticTacToe[2][1] << " |"
<< " " << ticTacToe[2][2] << " \n";

}
}
cout << "Enter destination filename: ";
readFileName2();
cout << "File written\n";
return 0;
}
problem is here
:
for (int col; col < 3; col++)

It should intialize the col
i mean
for (int col=0; col < 3; col++)
Topic archived. No new replies allowed.