Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h>
- #include <stdio.h>
- using namespace std;
- #define nr_lin 3
- #define nr_col 2
- int main() {
- srand(time(0));
- int i, j,nr_inc=1, mat[nr_lin][nr_col], mat2[nr_col][nr_lin];
- for (i = 0; i < nr_lin; i++) {
- for (j = 0; j < nr_col;j++) {
- mat[i][j] = nr_inc++;
- }
- }
- cout << endl;
- for (i = 0; i < nr_lin; i++) {
- for (j = 0; j < nr_col; j++) {
- cout << mat[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl;
- for (j = 0; j < nr_col;j++) {
- for (i = 0; i < nr_lin;i++) {
- mat2[j][i] = mat[i][j];
- }
- }
- for (i = 0; i < nr_col; i++) {
- for (j = 0; j < nr_lin; j++) {
- cout << mat2[i][j] << " ";
- }
- cout << endl;
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement