17.12.2012 Aufrufe

4. Prozedurales Programmieren

4. Prozedurales Programmieren

4. Prozedurales Programmieren

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

6. Iterative Fassung:<br />

int res;<br />

void main( String[] args ) {<br />

}<br />

IntList l = ... ;<br />

int mx;<br />

if( isempty(l) ) {<br />

mx = 0;<br />

} else {<br />

}<br />

int aktmax = head(l);<br />

IntList il = tail(l);<br />

while( !isempty(il) ) {<br />

}<br />

aktmax = max(aktmax,head(il));<br />

il = tail(il);<br />

res = aktmax;<br />

mx = res;<br />

println("maxl: " + mx );<br />

Vereinfachung durch Elimination unnötiger Variablen.<br />

0<strong>4.</strong>12.08 © A. Poetzsch-Heffter, TU Kaiserslautern<br />

90

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!