Ein Goto-Programm für die Multiplikation
if (x1 == 0) goto M4;
x3 = x2;
if (x3 == 0) goto M3;
x0 = x0 + 1;
x3 = x3 - 1;
goto M2;
x1 = x1 - 1;
goto M1;
return x0;
M1:
M2:
M3:
M4:
Annahmen:
Eingabewerte x1 und x2, Ausgabe x0, x0 mit 0 vorbelegt
Programme mit GOTO schwer verstehbar und kaum verifizierbar
Konstrukt sollte deshalb beim Programmieren nicht verwendet werden
Vorherige Folie
Nächste Folie
Zurück zur ersten Folie
Graphik-Version anzeigen