Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

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