You are not logged in.
Dear visitor, welcome to Aqua Computer Forum. If this is your first visit here, please read the Help. It explains how this page works. You must be registered before you can use all the page's features. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
![]() |
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
#include <stdio.h> /* Anzeige eines Stundenplans gemaess der Angaben auf Uebungsblatt 4, Aufgabe 1.*/ int main (void) { char auswahl; int wochentag,i=1; while(i==1){ fflush(stdin); /*Leerung der Standardeingabe*/ printf("Fuer welchen Wochentag soll der Stundenplan angezeigt werden?\n Bitte waehlen Sie: \n\n A Montag\n B Dienstag\n C Mittwoch\n D Donnerstag\n E Freitag\n F Samstag\n G Sonntag\n X Beenden\n"); printf("Ihre Eingabe: "); scanf("%c", &auswahl); /*Umwandlung des Wochentages in eine ganze Zahl für die switch-Anweisung*/ if (auswahl=='A') wochentag=1; else if (auswahl=='a') wochentag=1; else if (auswahl=='B') wochentag=2; else if (auswahl=='b') wochentag=2; else if (auswahl=='C') wochentag=3; else if (auswahl=='c') wochentag=3; else if (auswahl=='D') wochentag=4; else if (auswahl=='d') wochentag=4; else if (auswahl=='E') wochentag=5; else if (auswahl=='e') wochentag=5; else if (auswahl=='F') wochentag=6; else if (auswahl=='f') wochentag=6; else if (auswahl=='G') wochentag=7; else if (auswahl=='g') wochentag=7; else if (auswahl=='X') wochentag=0; else if (auswahl=='x') wochentag=0; else wochentag=8; /*Ausgabe des taeglichen Stundenplans*/ switch(wochentag){ case 1: printf("Stundenplan vom Montag\n -------------------\n 10 - 13 Uebung: ETA\n 13 - 15 Uebung: GdI\n -------------------\n \n"); i=1; break; case 2: printf("Stundenplan vom Dienstag\n -------------------\n 08 - 10 Vorlesung: Info1\n 10 - 12 Uebung: Info1\n -------------------\n \n"); i=1; break; case 3: printf("Stundenplan vom Mittwoch\n -------------------\n 08 - 11 Vorlesung: ETA\n 12 - 14 Vorlesung: Mathe A\n -------------------\n \n"); i=1; break; case 4: printf("Stundenplan vom Donnerstag\n -------------------\n 08 - 10 Vorlesung: Info1\n 10 - 12 Vorlesung: Mathe A\n -------------------\n \n"); i=1; break; case 5: printf("Stundenplan vom Freitag\n -------------------\n 08 - 10 Vorlesung: GdI\n 10 - 12 Vorlesung: Mathe A\n -------------------\n \n"); i=1; break; case 6: printf("Der Samstag ist vorlesungsfrei.\n\n"); i=1; break; case 7: printf("Der Sonntag ist vorlesungsfrei.\n\n"); i=1; break; case 0: printf("Sie verlassen nun das Stundenplanmenue. Auf Wiedersehen.\n\n"); i=0; break; default: printf("Falsche Eingabe.\n\n"); i=1; break; }} return 0; } |
![]() |
Source code |
1 |
default: printf("Falsche Eingabe.\n\n"); i=1; break; |
![]() |
Source code |
1 2 3 4 |
if (auswahl == '\n') { // Skip this junk. continue; } |
Quoted from "Katzenfreund"
es gibt strtolower - ist aber bei mir als Linuxfunktion markiert.![]()
-