I'm designing a game "Battleship" and I can't get get rid of a syntax error in the header file. I'm using a 2-D array for my grid.
The error is:
error C2059: syntax error : '{'
The error seems really simple, but for some reason i can't get rid of the syntax error.
Thanks for the help.
#ifndef BATTLEGRID_H
#define BATTLEGRID_H
#include <iostream>
using std::string;
const int ROW = 13; //row
const char COLUMN = 13; //column;
class BattleGrid
{
public:
//battleGrid constructor
BattleGrid(string = "" , int = 0 , char = 0);
//battleGrid destructor
~BattleGrid();
//string color[]; //sets the color
//string draw(); //draws the battlegrids
private:
string guess; //players guess
int xCoordinate; // letters
char yCoordinate; // numbers
//int backGround; //background
int x[ROW] = {1,2,3,4,5,6,7,8,9,10,11,12,13}; //array x error C2059
char y[COLUMN] = {'a','b','c','d','e','f','g','h','i','j','k','l','m'}; //array y error C2059
// 2-D grid error C2059
int grid[ROW][COLUMN] = { {0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0,0} };
};
#endif