] > Assignment 6: Arrays (Due: Th, May 29)

Assignment 6: Arrays (Due: Th, May 29)

The current assignment is a variant of assignment 2.

Submit your source file ‘chessboard.cpp’ with the ‘submit c230aa lab6 chessboard.cpp’ command.

<..chessboard.cpp..>
 #include <fstream>
 #include <string>
 using namespace std;
 
 class Piece{
      string color, type;
    public:
      Piece();
      void set(string, string);
      string get();
 };
 class Chess{
       Piece board [100][100];
       int dim;
    public:
       Chess( int );
       ~Chess();
       void add( int row, int col, string color, string type){
          board[row-1][col-1].set(color,type);
       }
 };
 int main()
 {
    Chess chess(4);
 
    chess.add(2, 4,  "black", "knight");
    chess.add(4, 1,  "white", "king");
    chess.add(4, 4,  "white", "rook");
    chess.add(3, 3,  "black", "king");
    chess.add(3, 4,  "white", "pawn");
 
    return 0;
 }
-_-_-