Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Bibliotheken
- #include <stdio.h>
- #include <conio.h>
- #include <stdlib.h>
- // Deklaration der Funktionen
- int zahl_eingabe();
- int ascii_strichmaenchen(int zahl);
- // Mainfunktion
- int main()
- {
- int z[3][1]; // Array für die Eingabe von Zahl 1-4
- z[0][0] = zahl_eingabe(); // Eingabe Zahl Eins verweist auf Funktion zahl_eingabe()
- z[1][0] = zahl_eingabe(); // Eingabe Zahl Zwei verweist auf Funktion zahl_eingabe()
- z[2][0] = zahl_eingabe(); // Eingabe Zahl Drei verweist auf Funktion zahl_eingabe()
- z[3][1] = 0; // Versuchszähler auf Null setzten
- do {
- if (z[3][1] < 1)
- {
- printf("Bitte geben Sie eine Zahl zwischen 1 und 9 ein.\n");
- }
- else
- {
- printf("Sie haben eine Zahl eingeben die groesser als 9 ist.\nBitte geben Sie nur Zahlen ein die kleiner als 10 und groesser als 0 sind!\nBitte wiederholen Sie daher die Eingabe!\n%i. Versuch\n", z[3][1] + 1);
- }
- scanf("%i", &z[3][0]);
- z[3][1] = z[3][1] + 1;
- } while(z[3][0] > 9 || z[3][0] < 1);
- system("cls");
- printf("%i <- 1, %i <- 2, %i <- 3, %i <- 4\n", z[0][0], z[1][0], z[2][0], z[3][0]);
- ascii_strichmaenchen(0);
- getch();
- }
- //Funktion zur Eingabe der ersten drei Zahlen!
- int zahl_eingabe()
- {
- int eingabe;
- printf("Bitte geben Sie eine beliebige Zahl ein.\n");
- scanf("%i", &eingabe);
- system("cls");
- return eingabe;
- }
- int ascii_strichmaenchen(int zahl)
- {
- printf(" %i%i%i\n", zahl, zahl, zahl);
- printf(" %i%i%i\n", zahl, zahl, zahl);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement