I am trying to make a board game. I have to input a .txt file and make it almost as a grid
F.F
...
.......
SSSSSSS
SSSSSSS
SSS
SSS
And have it come out as
7 F-.-F
|\|/|
6 .-.-.
|/|\|
5 .-.-.-.-.-.-.
|/|\|/|\|/|\|
4 S-S-S-S-S-S-S
|/|\|/|\|/|\|
3 S-S-S-S-S-S-S
|\|/|
2 S-S-S
|/|\|
1 S-S-S
a b c d e f g
This is somewhat what I have so far but I am just lost as in how to add the characters inbetween the inputed information
part of board.h
class BoardSet {
public:
void startingBoard(std::string line, int row);
void print();
private:
char board[6][6];
};
part of board.cpp
void BoardSet::startingBoard(std::string line, int row)
{
for(int i = 0; i < 7; i++)
{
board[row][i] = line[i];
}
}
void BoardSet::print()
{
int row = 7;
for(int i = 0; i < 7; i++)
{
for(int j = 0; j < 7;j++)
{
cout << board[i][j];
}
cout << endl;
}
}
Part of main.cpp
void initalizeBoard(istream& in, BoardSet& board)
{
string line;
int row = 0;
getline(in, line);
while(in)
{
board.startingBoard(line, row);
row++;
getline(in, line);
}
board.print();
}
all I need is a little guidance or just a simple example and I can take it from there, I am just completely stumped and don't know what to do.