Autor Beitrag
Porter2005
Hält's aus hier
Beiträge: 1



BeitragVerfasst: So 26.02.06 14:49 
Hi,

Das Problem:

Gegeben ist eine Gleichung mit 3 oder 4 Variabeln. Zum Beispiel: v=s/t. Nun, sollen davon 2 belibige Variabeln eingegeben werden. Die Dritte soll erechnet werden.
Ich suche eine möglichst Elegante Lösung.

Meine Ansätze:
Ich habe versucht das Problem über If zu lösen.
Also z.B:

ausblenden Delphi-Quelltext
1:
2:
3:
If (v = 0and (s != 0and (t != 0then v := s / t; 
If (v != 0and (s = 0and (t != 0then s := v * t; 
If (v != ) and (s != 0and (t = 0then t := s / v;



Diese Lösung sieht mir aber zimlich dirty aus. Ähnlich wie die aus QBasic und C Tagen. Das Problem ist ja auch eher Allgemeiner Natur.

Eine Andere Möglichkeit wäre z.B eine Funktion FormelUmstellen zu schreiben.
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: So 26.02.06 15:27 
Wenn Du nicht gerade einen Formel-Parser coden willst, wirst Du mit dieser Lösung leben müssen.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.