Last active
October 28, 2024 01:45
-
-
Save Sarverott/983cae3428e70e4c647f9513e9becede to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
matrix rotation | |
Sett Sarverott @ 2019 | |
*/ | |
#include <iostream> | |
using namespace std; | |
int **transpos(int **tab){ | |
int sizeX=sizeof(tab)/sizeof(tab[0]); | |
int sizeY=sizeof(tab[0])/sizeof(tab[0][0]); | |
int **tab2=new int*[sizeX]; | |
for(int i=0;i<sizeX;i++) | |
for(int j=0;j<sizeY;j++) | |
tab2[j][i]=tab[i][j]; | |
return tab2; | |
} | |
void printMatrix(int **tab){ | |
int sizeX=sizeof(tab)/sizeof(tab[0]); | |
int sizeY=sizeof(tab[0])/sizeof(tab[0][0]); | |
for(int i=0;i<sizeX;i++){ | |
cout<<"\n"; | |
for(int j=0;j<sizeY;j++) | |
cout<<tab[i][j]; | |
} | |
} | |
int main() | |
{ | |
int tab[2][3]={{3,4,5},{0,0,0}}; | |
printMatrix(transpos(tab)); | |
system("pause"); | |
//cout << "Hello world!" << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment