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], versuchszaehler; // Array für die Eingabe von Zahl 1-4
- z[0] = zahl_eingabe(); // Eingabe Zahl Eins verweist auf Funktion zahl_eingabe()
- z[1] = zahl_eingabe(); // Eingabe Zahl Zwei verweist auf Funktion zahl_eingabe()
- z[2] = zahl_eingabe(); // Eingabe Zahl Drei verweist auf Funktion zahl_eingabe()
- versuchszaehler = 0; // Versuchszähler auf Null setzten
- do {
- if (versuchszaehler < 1)
- {
- printf("Bitte geben Sie eine Zahl zwischen 1 und 9 ein.\n");
- }
- else
- {
- printf("Sie haben eine falsche Zahl eingeben!\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", versuchszaehler + 1);
- }
- scanf("%i", &z[3]);
- versuchszaehler = versuchszaehler + 1;
- } while(z[3] > 9 || z[3] < 1);
- system("cls");
- printf("%i <- 1, %i <- 2, %i <- 3, %i <- 4\n", z[0], z[1], z[2], z[3]);
- 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%i\n", zahl, zahl, zahl, zahl);
- printf(" %i%i%i%i\n", zahl, zahl, zahl, zahl);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement