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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
|
#include<iostream>
using namespace std;
void col_check(int ** source, int s_row, int s_col, int ** target, int t_row, int t_col, int f_row, int f_col)
{
if(f_col!=s_col)
{
for(int b=0; b<t_col; b++)
{
if(f_row==s_row-1)
{
}
}
}
}
void search_index(int ** source, int s_row, int s_col, int ** target, int t_row, int t_col)
{
for(int i=0; i<s_row; i++)
{
for(int j=0; j<s_col; j++)
{
if(source[i][j]==target[0][0])
{
/*found =*/ col_check(source, s_row, s_col, target, t_row, t_col, i, j);
}
}
}
int main()
{
int ** source, ** target;
source = new int * [4];
for(int i=0; i<4; i++)
{
source[i] = new int [4];
}
for(int i=0, m=1; i<4; i++)
for(int j=0; j<4; j++, m++)
source[i][j] = m;
target = new int * [2];
for(int i=0; i<2; i++)
{
target[i] = new int [2];
}
cout << "Enter four array values to be searched: ";
for(int i=0; i<2; i++)
for(int j=0; j<2; j++)
cin >> target[i][j];
cout << "\n~Source Array~" << endl;
for(int i=0; i<4; i++)
{
for(int j=0; j<4; j++)
cout << source[i][j] << "\t";
cout << endl;
}
cout << "\n~Target Array~" << endl;
for(int i=0; i<2; i++)
{
for(int j=0; j<2; j++)
cout << target[i][j] << "\t";
cout << endl;
}
search_index(source, 4, 4, target, 2, 2);
delete source;
delete target;
system("pause");
return 0;
}
|