Make a board with a txt and classes - BattleShip game

Hey there, guys
I need some really huge help sorting this thing out

Here's my Board and player class:
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
    class Board {
    public:
	    Board(const string &filename);
	    //bool putShip(const Ship &s);
	    void moveShips();
	    //bool attack(const Bomb &b);
	    void display()const;
	    void show()const;
	    void initializeGrid();



        private:
	    int numLines, numColumns;
	    //vector <Ship> ships;
	    vector <vector<int> > board;
    };


     //////////////PLAYER CLASS


    class Player{
    public:
	    Player(string playerName, string boardFileName);
	    void showBoard() const;
	    //Bomb getBomb() const;
	    //void attackBoard(const Bomb &b);
    private:
	   string name;
	   Board board;
    };

This is not made by me, these are the classes I need to implement on my final c++ project.

I'm struggling with making the board (developing the function void Player::viewBoard() )

The txt file will be something like this
Board 10x10

and I already developed a function that reads both 10's and saves it in numLines and numColumns:
1
2
3
4
5
6
7
8
9
10
11
12
13
    Board::Board(const string &filename){


	    string tmp;
	    ifstream config;
	    config.open(filename.c_str()); 

	    if (config.is_open()) {

		    config >> tmp >> numLines >> tmp >> numColumns;
	    }

    }

But now what? How can I make a Board for the Player player with the dimensions specified on the board?

ANy help? I really appreciate any help guys, this can save my semester. Thank you all and best regards.
Last edited on
Topic archived. No new replies allowed.