nic

ad
mail@pastecode.io avatar
unknown
c_cpp
2 years ago
508 B
1
Indexable
Never
#include <iostream>

using namespace std;

int trans(int** tab1, int n, int m)
{
	int** tab2 = new int* [m];
	for (int k = 0; k < n; k++) tab2[k] = new int[n];
	for (int i = 0; i < n; i++)
	{
		for(int j = 0; j < m; j++)
		{ 
			tab2[j][i] = tab1[i][j];
		}
	}
	return **tab2;
}

int main()
{
	int n = 6;
	int m = 4;
	int** tab1 = new int* [n];
	for (int i = 0; i < n; i++) tab1[i] = new int[m];
	cout << "Wskaznik transponowanej macierzy: " <<trans(tab1, n, m);
	delete[] tab1;
}