1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
#include <iostream>
#include <iomanip>
using namespace std;
const int NUMBER_OF_ROWS = 6;
const int NUMBER_OF_COLUMS = 5;
void printMatrix( int matrix[][NUMBER_OF_COLUMS], int NUMBER_OF_ROWS );
int main()
{
int board [NUMBER_OF_ROWS][NUMBER_OF_COLUMS]
= { { 23, 5, 6, 15, 18 },
{ 4, 16, 24, 67, 10 },
{ 12, 54, 23, 76, 11 },
{ 1, 12, 34, 22, 8 },
{ 81, 54, 32, 67, 33 },
{ 12, 34, 76, 78, 9 } };
printMatrix ( board, NUMBER_OF_ROWS );
cout << endl;
cin.get();
return 0;
}
void printMatrix ( int matrix[][NUMBER_OF_COLUMS], int noOfRows)
{
int row,col;
for( row = 0; row < noOfRows; row++ )
{
for( col = 0; col < NUMBER_OF_COLUMS; col++)
cout << setw(5) << matrix[row][col] << " ";
cout << endl;
}
}
|