#include <iostream>
#include <iomanip>
// Function that takes a 2-D array as a parameter
void printArr(int paramArr[][15] , int rows, int cols )
{
int i, j;
for (i = 0 ; i < rows; i ++)
{
for (j = 0; j < cols; j++)
{
cout << setw(3) << paramArr[i][j] << " ";;
}
cout << endl;
}
}
int main()
{
int twodarr [10][15];
// int hugearr [40][20][40][10][10][10][10];
int i, j;
for (i = 0 ; i < 10; i ++)
for (j = 0; j < 15; j++)
twodarr[i][j] = i * j;
for (i = 0 ; i < 10; i ++)
{
for (j = 0; j < 15; j++)
{
cout << setw(3) << twodarr[i][j] << " ";;
}
cout << endl;
}
// call a function to print the 2-d array
cout << endl << "The same info from a function" << endl;
printArr (twodarr, 10, 15);
cout << endl << endl << "The same output without an array" << endl;
cout << " : ";
for (j = 0 ; j < 15; j ++)
cout << setw(3) << j << " ";
cout << endl;
cout << "-----";
for (j = 0 ; j < 15; j ++)
cout << "----";
cout << endl;
for (i = 0 ; i < 10; i ++)
{
cout << setw(3) << i << ": ";
for (j = 0; j < 15; j++)
{
//twodarr[i][j] = i * j;
//cout << twodarr[i][j];
cout << setw(3) << i * j << " ";
}
cout << endl;
}
}