Last active
February 24, 2017 04:39
-
-
Save sebassdc/f29fb541c39cbf54e6de3de674661419 to your computer and use it in GitHub Desktop.
clase-22-02
This file contains hidden or 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
#include <iostream> | |
using namespace std; | |
void print_arr(int matriz[],int size) { | |
cout << "{"; | |
for (int i = 0; i < size; i++) { | |
cout << matriz[i]; | |
if (i < size - 1) cout << ", "; | |
} | |
cout << "}"; | |
} | |
main() { | |
int n_f, n_c; | |
n_f = 3; n_c = 3; | |
int matriz[n_f][n_c] = { | |
{6, 9, 6}, | |
{2, 4, 4}, | |
{4, 5, 6}, | |
}; | |
// cout << "Ingrese el numero de filas: "; | |
// cin >> n_f; | |
// cout << "Ingrese el numero de columnas: "; | |
// cin >> n_c; | |
// int matriz[n_f][n_c]; | |
// system("cls"); | |
// cout << "Ingrese los elementos: " << endl; | |
// for (int i = 0; i < n_f; i++) { | |
// for (int j = 0; i < n_c; j++) { | |
// cout << "Elemento[" << (i+1) << "][" << (j+1) << "] = "; | |
// cin >> matriz[i][j]; | |
// } | |
// } | |
cout << "Matriz original: \n"; | |
// Imprimir matriz | |
cout << "{\n"; | |
for (int i = 0; i < n_f; i++) { | |
cout << "\t"; | |
cout << "{"; | |
for (int j = 0; j < n_c; j++) { | |
cout << matriz[i][j]; | |
if (j < n_c - 1) cout << ", "; | |
} | |
cout << "}"; | |
if (i < n_c - 1) cout << ", "; | |
cout << "\n"; | |
} | |
cout << "}\n"; | |
cout << "Matriz Transpuesta: \n"; | |
cout << "{\n"; | |
for (int i = 0; i < n_f; i++) { | |
cout << "\t"; | |
cout << "{"; | |
for (int j = 0; j < n_c; j++) { | |
cout << matriz[j][i]; | |
if (j < n_c - 1) cout << ", "; | |
} | |
cout << "}"; | |
if (i < n_c - 1) cout << ","; | |
cout << "\n"; | |
} | |
cout << "}\n"; | |
system("pause"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment