Quick actions

cmd+k|ctrl+k

Navigation

Languages

954

Snippet info

Language

Cpp

Visibility

public

Author

nxnxngh

Created

2018-11-28T22:22:51Z

Updated

2018-12-04T21:07:47Z

#include <iostream>
#include<ctime>

using namespace std;

int main()
{
	srand(time(NULL));
	setlocale(LC_ALL, "ru");
	//Creation
	int row = 6;
	int cols = 3;
	int **mass = new int* [row];
	for (int i = 0; i < row; i++)
	{
		mass[i] = new int[cols];
	}
	//Generating element value
	for (int i = 0; i < row; i++)
	{
		for (int j = 0; j < cols; j++)
		{
			mass[i][j] = rand()%20;
			cout << mass[i][j] << "\t";
		}
		cout << endl;
	}
	//sum rows n and m
int n= rand()%6,m= rand()%6;
int arr[3];
cout << endl<< endl<< endl<<"sum rows "<<n<<" and "<<m<< " : "<< endl;
for (int j = 0; j < cols; j++)
		{
			arr[j] = mass[n][j]+ mass[m][j];
			cout << arr[j] << "\t";
		}

	//Deleting
	for (int i = 0; i < row; i++)
	{
		delete[] mass[i];
	}
	delete[] mass;
	system("PAUSE");
	return 0;
}
INFO