Would Format Showboard Function Output String Following Way Code Include Gameboardhpp Game Q37118458

How would I format my ShowBoard() function to output my stringin the following way?

my code:

#include “gameboard.hpp”

GameBoard::GameBoard(std::string letters)
{
   for(int i = 0; i < 4; ++i)
   {
       for(int j = 0; j < 4; ++j)
       {
          this->letters[i][j] = letters[i * 4 + j];
          
       }
   }
}

char GameBoard::GetLetterByRowCol(int row, int col)
{
   /*
   *Returns the character at the specified row andcolumn.
   */
   return this->letters[row][col];
}

std::string GameBoard::ShowBoard()
{
   /*
   *Returns a string representation of the board (shouldinclude new lines as needed).
   */
   std::string output = “”;
for(int i = 0; i < 4; ++i)
   {
       for(int j = 0; j <

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.