Código C++:
Ver original
#define IMAG_X 50 #define IMAG_Y 27 int carga_nivel(char mapa[][IMAG_Y]){ ifstream fichero("nivel.txt"); char ch; for(int i=0; i<=IMAG_X; i++){ for(int j=0; j<=IMAG_Y; j++){ ch = fichero.get(); mapa[i][j] = ch; } } return 0; } int muestra_nivel(const char mapa[][IMAG_Y]){ //no imprime lo deseado, pero se aproxima char ch; for(int i=0; i<=IMAG_X; i++){ for(int j=0; j<=IMAG_Y; j++){ } } return 0; }
el fichero nivel.txt es este
Código:
y esta la salida:[hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh] v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v (hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh)
Código:
Muchas gracias[hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh] v..........................................................v v..........................................................v v..........................................................v v..........................................................v v.........................................................vv v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v ...........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v.......................................................... v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v..........................................................v v........................
