Quick actions

cmd+k|ctrl+k

Navigation

Languages

lab7 (975)

Snippet info

Language

Cpp

Visibility

public

Author

andrusus.korotkovus

Created

2018-12-20T23:44:58Z

Updated

2018-12-20T23:44:58Z

#include <iostream>

using namespace std;

int main()
{
	int n; //n- размерность 
	cout << "Enter n" << endl;
	cin >> n;

	int **array = new int* [n];

	for (int i = 0; i < n; i++)
	{
		array[i] = new int[n];
	}
	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			array[i][j] = rand() % 20;
		}
	}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			cout << array[i][j] << "\t";
		}
		cout << endl;
	}

	for (int i = 0; i < n; i++)
	{
		delete[] array[i];
	}
	delete[] array;

}


INFO