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
|
#include <iostream>
using namespace std;
const int NCOLS = 3;
const char EMPTY = ' ';
bool compare(char array1[][NCOLS], char array2[][NCOLS], int nrows);
int main ()
{
char array1[][NCOLS]= {{'A', 'E', 'I'}, {'O', 'U', 'G'}, {'Q', 'M', 'D'}} ;
char array2[][NCOLS]= {{'b', 'E', 'I'}, {'O', 'u', 'G'}, {'Q', 'M', 'D'}} ;
compare(array1, array2, 3);
system ("pause");
return 0;
}
bool compare(char array1[][NCOLS], char array2[][NCOLS], int nrows)
{
bool found = false;
int row = 0;
int col = 0;
nrows = 3;
for (col; col < nrows; col++)
{
for (row; row < nrows ; row++)
if (array1[0][0] == array2[0][0])
{
found = true;
cout << "Same!" << endl;
}
else
{
found = false;
cout << "Not Same!" << endl;
}
}
return found;
}
|