Skip to content

Instantly share code, notes, and snippets.

@gizemiskender
Last active August 29, 2015 13:59
Show Gist options
  • Select an option

  • Save gizemiskender/10910862 to your computer and use it in GitHub Desktop.

Select an option

Save gizemiskender/10910862 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
int **board;
int rows;
int columns;
cout << "enter a number of rows: ";
cin >> rows;
cout << "enter a number of columns: ";
cin >> columns;
board = new int* [rows];
for(int i = 0; i<rows; i++)
board[i] = new int[columns];
for(int i = 0; i< rows; i++)
{
for(int j = 0; j < columns; j++)
{
cin >> board[i][j];
}
}
for(int i = 0; i< rows; i++)
{
for(int j = 0; j < columns; j++)
{
cout << board[i][j] <<" ";
}
cout << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment