I'm trying to multiply a 2d array by itself until the specified location is no longer zero but for some reason it will not print on the console.
Why is this happening?
Does my code do what I want it to do?
//assume I called the function correctly
void gr2 (int graph2[][6])
{
int result[6][6] = {0};
int counter = 0;
if (graph2[0][1] == 1){
cout << "Shortest path from A to B is: " << graph2[0][1] << endl;
}
else {
while (result[0][1] < 1){
for(int r = 0; r < 7; ++r)
for(int c = 0; c < 7; ++c)
for(int x = 0; x < 7; ++x)
{
result[r][c]+= graph2[r][x] * graph2[x][c];
}
counter++;
}
cout << "Shortest path from A to B is: " << counter << endl;
}
}