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
|
#define numRows 3
#define numCols 7
#define TotalNum (numRows*numCols)
using namespace std;
int arr[numRows][numCols] = {{0,1,2,3,4,5,6}, {7,8,9,10,11,12,13},{14,15,16,17,18,19,20}};
bool isOdd( int integer )
{
if ( integer % 2== 0 )
return true;
else
return false;
}
void display(int p[][numCols])
{
printf("\n");
for (int i = 0; i< numRows;i++)
{
for ( int j = 0;j< numCols;j++)
{
if(isOdd(p[i][j]) == false)
cout << p[i][j] << " is odd." << endl;
else
cout << p[i][j] << " is even." << endl;
}
printf("\n");
}
}
int main() {
display(arr);
}
|