Kontroll-Prozedur II

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]

AddressBook2.om
IF command = "quit" THEN EXIT END;
IF command = "new" THEN
   IF FindFreeSlot(addressBook, index) THEN
      IF ReadEntry(entry) THEN
         addressBook[index] := entry;
      END;
   ELSE
      Write.Line("Sorry, your address book is already full!");
   END;
ELSIF command = "list" THEN
   PrintEntries(addressBook);
ELSIF command = "search" THEN
   IF ReadName(name) THEN
      IF SearchByName(addressBook, name, index) THEN
         PrintEntry(addressBook[index]);
      ELSE
         Write.Line("Sorry, not found!");
      END;
   END;
ELSIF command = "delete" THEN
   IF ReadName(name) THEN
      IF SearchByName(addressBook, name, index) THEN
         addressBook[index].used := FALSE;
      ELSE
         Write.Line("Sorry, not found!");
      END;
   END;
ELSIF command = "help" THEN
   Write.String("Supported commands: ");
   Write.Line("delete, help, list, new, quit, search");
ELSE
   Write.Line("Unknown command. Please try ``help''!");
END;

 [Vorheriges Kapitel]  [Vorherige Seite]  [Inhaltsverzeichnis]  [Nächste Seite]  [Nächstes Kapitel]
Copyright © 2004, 2005 Andreas Borchert, in HTML konvertiert am 18.02.2005