Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "Table.hpp"
- #include <iostream>
- //Table:: n=7;
- //char** board = new char*[n];
- int Table::getN() {
- return this->n;
- }
- void Table::setN(int n) {
- this->n = n;
- }
- char** Table::getBoard() {
- return this->board;
- }
- void Table::setBoard(char** board) {
- this->board = board;
- }
- void Table::createBoard(int n) {
- for (int i = 0; i < n; i++)
- this->board[i] = new char[n];
- }
- void Table::changeSize(int k) {
- char** temp = new char*[k];
- for (int i = 0; i < k; i++)
- temp[i] = new char[k];
- for (int i = 0; i < this->n; i++)
- for (int j = 0; j < this->n; j++)
- temp[i][j] = this->board[i][j];
- delete[] this->board;
- this->board = temp;
- this->n = k;
- //delete[] temp;
- }
- void Table::fillCells() {
- int k = this->n;
- for (int i = 0; i < k; i++)
- for (int j = 0; j < k; j++)
- this->board[i][j] = 'x';
- }
- void Table::printBoard() {
- int k = this->n;
- for (int i = 0; i < k; i++) {
- for (int j = 0; j < k; j++)
- std::cout << this->board[i][j];
- std::cout << "\n";
- }
- //std::cout << this->board[6][6];
- }
- void Table::destroyBoard() {
- delete[] this->board;
- }
- Table::Table(int n) {
- this->n = n;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement