16 /* Hauptbildschirm ausgeben */
20 printf("C128-Kassenprogramm\n\n");
21 printf("Eingenommen: %d Euro, Verkauft: %d Flaschen\n\n", money * 100, items_sold);
22 for (; i < num_items; ++i)
23 printf("Item %x: %s (%d Cents, %d mal verkauft)\n", i, status[i].item_name, status[i].price, status[i].times_sold);
24 printf("\nBefehle: s) Save Data\tp) Toggle Printing\n");
27 /* Druckt eine entsprechende Zeile aus */
28 void print_log(uc n, int einheiten, char *nickname) {
30 Transaction-ID (Anzahl verkaufter Einträge, inklusive des zu druckenden!)
32 Eintragname (= Getränk)
35 Nickname (falls es vom Guthaben abgezogen wird)
37 printf("[%d] UHRZEIT - %s - %d - %d - an %s\n", items_sold, status[n].item_name, status[n].price, einheiten, (nickname != NULL ? nickname : "Unbekannt"));
40 /* Dialog, der einen durch's Abrechnen der Einträge führt */
43 char entered[5] = {'1', 0, 0, 0, 0};
47 if (status[n].item_name == NULL)
48 printf("ERROR: No such item\n");
50 printf("Wieviel Einheiten \"%s\"?\n", status[n].item_name);
55 else if (c == 45 && i == 0)
57 else if (c > 47 && c < 58)
60 einheiten = atoi(entered) * negative;
61 status[n].times_sold += einheiten;
62 money += status[n].price * einheiten;
63 items_sold += einheiten;
64 // TODO: NULL in nickname des guthabenden ändern
66 print_log(n, einheiten, NULL);
73 /* Bildschirm anzeigen */
75 /* Tastatureingaben abfragen */
77 /* und eventuell weitere Dialoge anzeigen */
82 printf("Statefile saved, press ANYKEY to continue...\n");
84 } else if (c == 'p') {
85 printing = (printing == 1 ? 0 : 1);
86 printf("Printing is now %s, press ANYKEY to continue...\n", (printing == 1 ? "on" : "off"));