// Übungen zu Grundlagen der Programmierung in C // Codefragmente zu Übungsblatt IX Aufgabe 3 // WS 2005/2006 // TU Clausthal // Autor: Dipl.-Inf. Carsten Giesemann // Datum: 13.01.2006 // Dimensionen des Labyrinths const int x_dim = 12; const int y_dim = 10; // Labyrinth nach Bild A char labyrinth[y_dim][x_dim] = { { '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#' }, { '#', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#', '#' }, { '#', ' ', '#', '#', '#', ' ', '#', '#', '#', ' ', ' ', '#' }, { '#', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', ' ', '#', '#' }, { '#', '#', '#', '#', '#', '#', '#', '#', '#', ' ', ' ', '#' }, { '#', '#', ' ', '#', ' ', ' ', ' ', '#', '#', '#', ' ', '#' }, { '#', ' ', ' ', '#', ' ', '#', ' ', ' ', ' ', ' ', ' ', '#' }, { '#', ' ', '#', '#', ' ', '#', ' ', ' ', '#', '#', '#', '#' }, { '#', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '>' }, { '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#' } }; // Labyrinth nach Bild E char labyrinth[y_dim][x_dim] = { { '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#' }, { '#', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', ' ', '#' }, { '#', ' ', '#', '#', '#', '#', ' ', '#', ' ', '#', ' ', '#' }, { '#', ' ', ' ', ' ', ' ', ' ', ' ', '#', ' ', '#', '#', '#' }, { '#', ' ', '#', '#', '#', '#', '#', '#', ' ', ' ', ' ', '#' }, { '#', ' ', '#', '#', ' ', ' ', ' ', '#', '#', '#', ' ', '#' }, { '#', ' ', ' ', '#', ' ', '#', ' ', ' ', '#', ' ', ' ', '#' }, { '#', ' ', '#', '#', ' ', '#', ' ', '#', '#', '#', ' ', '#' }, { '#', ' ', ' ', ' ', ' ', '#', ' ', ' ', ' ', ' ', ' ', '>' }, { '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#', '#' } }; // Funktion zur Labyrinth-Ausgabe void druckeLabyrinth(); void druckeLabyrinth() { for (int y = 0; y < y_dim; y++) { for (int x = 0; x < x_dim; x++) { printf("%c", labyrinth[y][x]); } printf("\n"); } return; }