![]() |
Re: Fehler beim Einsatz von Schleife
Zitat:
Zitat:
Delphi-Quellcode:
Gruß Hawkeye
program Project1;
{$APPTYPE CONSOLE} uses SysUtils; var a, b, c : Boolean; begin WriteLn; WriteLn ('X = a or b and c'); WriteLn ('Y = (a or b) and c'); WriteLn ('Z = a or (b and c)'); WriteLn; WriteLn ('abc X Y Z'); WriteLn ('----------'); for a := False to True do for b := False to True do for c := False to True do WriteLn (Format('%d%d%d %d %d %d', [Ord(a), Ord(b), Ord(c), Ord(a or b and c), Ord((a or b) and c), Ord(a or (b and c))])); end. |
Re: Fehler beim Einsatz von Schleife
Zitat:
Zweitens: Ich würde zusätzlich klammern bei Deiner Lösung, egal, wie die Bindungsregeln nun zufällig sind. Drittens: Ich finde meine Lösung weiterhin anschaulicher. Symbolisch lautet meine Lösung ja: if (not Ausnahmefall) and (Feld[i,j]=1) then inc(k,1); der Ausnahmefall wird aufgelöst als ((i=x) and (j=y))). Bei Deiner Lösung muss man (ich jedenfalls) kurz nachdenken (letztlich versteckst Du das not in das <>). |
Re: Fehler beim Einsatz von Schleife
Okay, Hawkeye, du hast offenbar Recht. Die Ausgabe meines Testprogramms hab ich offenbar falsch interpretiert. Außerdem bin ich es aus der Mathematik gewöhnt, dass die Konjunktion so stark bindet wie die Disjunktion, die Implikation und Äquivalenz weniger stark und die Negation am stärksten.
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:19 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz