Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 1: neue Adresse
- // 2: alle Adressen anzeigen
- // 3: Adresse ändern
- #include <stdio.h>
- #include <string.h>
- typedef struct adresse_ {
- char name[50];
- char strasse[50];
- int hausnummer;
- char stadt[50];
- int plz;
- }adresse;
- int eingabe, i;
- static void start_ausgabe () {
- printf("Bitte wählen Sie eine folgenden Moeglichkeiten:\n\n");
- printf("Möglichkeit [1] = Neue Adresse eingeben.\n");
- printf("Möglichkeit [2] = Adresse anzeigen.\n");
- printf("Möglichkeit [3] = Adresse ändern.\n");
- printf("Möglichkeit [4] = Verlassen.\n");
- }
- static void adresse_eingabe (adresse *in) {
- printf("Eintrag = %d\n", i);
- printf("Name: ");
- scanf("\t%s", &in->name);
- //printf("\n");
- printf("Straße Hausnummer: ");
- scanf("\t%s %d", &in->strasse, &in->hausnummer);
- //printf("\n");
- printf("PLZ Stadt: ");
- scanf("\t%d %s", &in->plz, &in->stadt);
- printf("\n");
- }
- static void print_adresse (adresse out[i]) {
- printf("Adresse:\n", out[i].name);
- printf("%s\n%s", out[i].name);
- printf("%s %d\n",out[i].strasse, out[i].hausnummer);
- printf("%d %s\n\n", out[i].plz, out[i].stadt);
- }
- int main (){
- int eingabe2, number;
- adresse new[i];
- do {
- start_ausgabe();
- scanf("%d", &eingabe);
- printf("\n");
- switch (eingabe) {
- case 1:
- i++;
- adresse_eingabe(&new[i]);
- //print_adresse(new);
- break;
- case 2:
- printf("Welche Adresse wollen Sie sehen? ");
- scanf("%d", &number);
- printf("Nummer = %d\n", number);
- printf("\n\n");
- print_adresse(&new[number]);
- break;
- case 3:
- break;
- case 4:
- printf("Bye!\n");
- return 0;
- break;
- default:
- break;
- }
- printf("Wollen Sie fortfahren?\n[1] = JA\n[0] = NEIN\n");
- scanf("%d", &eingabe2);
- printf("\n");
- if (eingabe2 == 0) {
- printf("Bye!\n");
- return 0;
- }
- } while (eingabe != 4);
- printf("Bye!\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement