Created
June 22, 2013 16:36
-
-
Save leopic/5841510 to your computer and use it in GitHub Desktop.
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; | |
| int main() { | |
| int dimensiones, | |
| entrada, | |
| i, | |
| j; | |
| cout << "Dimensiones del vector: " << endl; | |
| cin >> dimensiones; | |
| int matriz[dimensiones][dimensiones]; | |
| // recorriendo las filas | |
| for (i = 0; i < dimensiones; i++) { | |
| // recorriendo las columnas | |
| for(j = 0; j < dimensiones; j++) { | |
| cout << "viene la bolita: " << i << j << endl; | |
| cin >> entrada; | |
| matriz[i][j] = entrada; | |
| } | |
| } | |
| cout << "-- ~~ -- ~~ -- ~~ --" << endl; | |
| // recorriendo las filas | |
| for (i = 0; i < dimensiones; i++) { | |
| // recorriendo las columnas | |
| for(j = 0; j < dimensiones; j++) { | |
| // barra al inicio de las filas | |
| if (j == 0) { | |
| cout << "| "; | |
| } | |
| cout << matriz[i][j] << " | "; | |
| // final de la linea | |
| if (j == dimensiones-1) { | |
| cout << endl; | |
| } | |
| } | |
| } | |
| cout << "-- ~~ -- ~~ -- ~~ --" << endl; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment