Einzelnen Beitrag anzeigen

Speedi2000

Registriert seit: 28. Feb 2010
15 Beiträge
 
#27

Re: Taschenrechner - String durchsuchen

  Alt 1. Mär 2010, 17:28
Woah, um ehrlich zu sein seh ich da garnicht durch mit der Liste und so, denke das ist auch noch zu hoch für das Niveau wie wir den Taschenrechner machen sollen, weil wir haben ja mit Delphi grade erst angefangen.

Danke schonmal für die Hilfe, aber so kann ich das denk ich schlecht machen, weil wir ja soweit noch nicht sind =/

Muss ich wohl weiter mit meinem rumprobieren

EDIT://
Delphi-Quellcode:
if neo.caption = '*'
then
begin
ne.caption := floattostr(strtofloat(ne.caption)*strtofloat(display.text));
display.text := '0';
neo.caption := '*';
end
else
begin
if nz1.caption = ''
then
begin
nz1.Caption := display.text;
no1.caption := '*';
display.text := '0';
end
else
begin
nz2.caption := display.text;
no2.caption := '*';
punkt.caption := floattostr(strtofloat(nz1.caption)*strtofloat(nz2.caption));
if neo.caption = '+'
then
begin
ne.caption := floattostr(strtofloat(ne.caption)+strtofloat(punkt.caption));
nz1.caption := '';
nz2.caption := '';
no1.caption := '';
no2.caption := '';
neo.caption := '*';
end;
if neo.caption = '-'
then
begin
ne.caption := floattostr(strtofloat(ne.caption)-strtofloat(punkt.caption));
nz1.caption := '';
nz2.caption := '';
no1.caption := '';
no2.caption := '';
neo.caption := '*';
end;
if neo.caption = '*'
then
begin
ne.caption := floattostr(strtofloat(ne.caption)*strtofloat(punkt.caption));
nz1.caption := '';
nz2.caption := '';
no1.caption := '';
no2.caption := '';
neo.caption := '*';
end
end
end
end;
Habe jetzt das Problem dass wenn er im neo.caption nen '-' drin zu stehen hat, er irgendwas rechnet, aber nicht das was er soll... z.B. bei 5+5+5+5+5-6*3*(an der stelle bekommt er 126 raus und nicht 7 wie er eigentlich sollte).

Find meinen Fehler aber nicht
  Mit Zitat antworten Zitat