Write a function that accepts an array of integers and determines the product of each two integers. Although you can create a fixed size array in main, your function should work no matter what size of array is passed to the function.
MY code:
#include <iostream>
using namespace std;
void Product(float matrix[4][4], int rows, int columns)
{
int iRow, iColumn, ia, ib;
for(iRow = 0; iRow < rows; iRow++)
for(iColumn = 0; iColumn < columns; iColumn++)
{
for(ia = iRow; ia < rows; ia++)
for(ib = iColumn + !!(ia == iRow); ib < columns; ib++)
cout << ("\t ", matrix[iRow][iColumn] * matrix[ia][ib]) << endl;
cout << ("");
}
}
My code was incorrect and my teacher gave me this note:
If the array [3 7 8 2 -3] is passed to the function, it prints to the screen [3 21 56 16 -6]. (note the first element of the array is not modified) Pass the array to the function and then print the resulting array to the console. (you do not need to store the result in a new array)
please help me fix my function! thank you.