Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

Arrays and multiplying into a 2d array - C++ Code Bank


Arrays and multiplying into a 2d array
Short and sweet intro to using arrays in operations and loops. Less than 30 lines of code. Might be practical as part of encryption program.
                #include <iostream>

using namespace std;

int main()
{
int m=3, n=2;
int x[3] = {1,2,3};
int y[2] = {4,5};
int z[m][n];
	for (int j=0;j<n;j++)
	{
	//cout << x[j] << endl;
		for (int i=0;i<m;i++)
		{
		z[m][n] = y[j]*x[i];
		//cout << y[j]*x[i] << " ";
		cout << z[m][n] << " ";
		}
	cout << endl;
	}
cout << endl;
}

            
Comments
Sorry but there are no comments to display