use a recursive algorithm to determine if a number is in the 2D array of random integers

So i have printed out a 9X9 2D array filled with random integers.
my next step is check if numbers that are provided from an input file are in my 2D array. The numbers can only be valid/true if they are right next to each other in my array.


for example

154259
123437 in this example the number 1243, 5934 are valid numbers
764585 also i cannot reuse any number twice on my 2d array
345312


here is my code.. what i have so far

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
 int main(){
        
        srand(time(NULL));
        char array2D[9][9];
        for (int row = 0; row<10 ; row++){
            for (int col = 0; col<10 ; col++){
                
                array2D[row][col]= rand()%9+'1';
                cout<< array2D[row][col] << " ";
                
            }
            cout << endl;
            
        }
    findNumb();     // im having issues using calling this function as well
        return 0;
    
}



int findNumb(int row, int col, int a[][9]){

    string line;
    ifstream myfile ("number.txt");
    if (myfile.is_open())
    {
        while ( getline (myfile,line) )
        {
            cout << line << '\n';
        }
        
        for (int i = 0; i < line.length(); i++)
        {
            if(line[i] == a[0][0]) // not sure how to search through the array
                ....
                // this is where im getting stuck
                }
else
        
    }
    
    return 0;
}


i have to use a recursive algorithm to solve this. And print out the coordinates for each number that i found. Please some help!

example from inputfile:

875
135243
125
7653
3285452
The matrix you have printed is not 9 x 9

The function you are trying to call is not implemented
sorry you are right, silly error, corrected that,
also i know its not implemented, but when i had it do something simple like just cout the lines of numbers, it would give me an error, not sure if i called on it correctly.
Topic archived. No new replies allowed.