吖
吖诚
Unregistered / Unconfirmed
GUEST, unregistred user!
type
PSimpleNode=^TSimpleNode;
TSimpleNode=record
Val:double;
Op:char;
NextSimpleNode;
end;
Top= PSimpleNode;
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button15: TButton;
Button16: TButton;
Button17: TButton;
Edit1: TEdit;
procedure Button10Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button17Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Top,Cur,NextSimpleNode;
end;
var
Form1: TForm1;
A:Extended;
implementation
{$R *.dfm}
procedure TForm1.Button10Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'0';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'1';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'2';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'3';
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'4';
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'5';
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'6';
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'7';
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'8';
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'9';
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
if strpos(Pchar(edit1.Text),'.')=nil then
Edit1.Text:=edit1.Text+'.';
end;
procedure TForm1.Button17Click(Sender: TObject);
begin
Edit1.Text:='';
end;
procedure TForm1.Button16Click(Sender: TObject);
begin
Next:=New(PsimpleNode);
Cur:=Top;
Cur^.Val:=StrTofloat(Edit1.Text);
Cur^.Op:='+';
Edit1.Text:='';
Cur^.Next:=Next;
Cur:=Next;
end;
procedure TForm1.Button15Click(Sender: TObject);
begin
Next:=New(PsimpleNode);
Cur:=Top;
Cur^.Val:=StrTofloat(Edit1.Text);
Cur^.Op:='-';
Edit1.Text:='';
New(Next);
Cur^.Next:=Next;
Cur:=Next;
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
Next:=New(PsimpleNode);
Cur:=Top;
Cur^.Val:=StrTofloat(Edit1.Text);
Cur^.Op:='*';
Edit1.Text:='';
New(Next);
Cur^.Next:=Next;
Cur:=Next;
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
Next:=New(PsimpleNode);
Cur:=Top;
Cur^.Val:=StrTofloat(Edit1.Text);
Cur^.Op:='/';
Edit1.Text:='';
New(Next);
Cur^.Next:=Next;
Cur:=Next;
end;
procedure TForm1.Button12Click(Sender: TObject);
begin
While Cur^.Op='+' do // Next<>nil
Edit1.Text:=floatTostr(StrTofloat(Edit1.Text)+Cur^.Val);
end;
end.
请问如何才可以实现连算(+。-。*。/)按先后次序。该程序错在那里???谢谢~!
PSimpleNode=^TSimpleNode;
TSimpleNode=record
Val:double;
Op:char;
NextSimpleNode;
end;
Top= PSimpleNode;
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Button8: TButton;
Button9: TButton;
Button10: TButton;
Button11: TButton;
Button12: TButton;
Button13: TButton;
Button14: TButton;
Button15: TButton;
Button16: TButton;
Button17: TButton;
Edit1: TEdit;
procedure Button10Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button17Click(Sender: TObject);
procedure Button16Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
procedure Button14Click(Sender: TObject);
procedure Button13Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Top,Cur,NextSimpleNode;
end;
var
Form1: TForm1;
A:Extended;
implementation
{$R *.dfm}
procedure TForm1.Button10Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'0';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'1';
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'2';
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'3';
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'4';
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'5';
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'6';
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'7';
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'8';
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
Edit1.text:=Edit1.Text+'9';
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
if strpos(Pchar(edit1.Text),'.')=nil then
Edit1.Text:=edit1.Text+'.';
end;
procedure TForm1.Button17Click(Sender: TObject);
begin
Edit1.Text:='';
end;
procedure TForm1.Button16Click(Sender: TObject);
begin
Next:=New(PsimpleNode);
Cur:=Top;
Cur^.Val:=StrTofloat(Edit1.Text);
Cur^.Op:='+';
Edit1.Text:='';
Cur^.Next:=Next;
Cur:=Next;
end;
procedure TForm1.Button15Click(Sender: TObject);
begin
Next:=New(PsimpleNode);
Cur:=Top;
Cur^.Val:=StrTofloat(Edit1.Text);
Cur^.Op:='-';
Edit1.Text:='';
New(Next);
Cur^.Next:=Next;
Cur:=Next;
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
Next:=New(PsimpleNode);
Cur:=Top;
Cur^.Val:=StrTofloat(Edit1.Text);
Cur^.Op:='*';
Edit1.Text:='';
New(Next);
Cur^.Next:=Next;
Cur:=Next;
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
Next:=New(PsimpleNode);
Cur:=Top;
Cur^.Val:=StrTofloat(Edit1.Text);
Cur^.Op:='/';
Edit1.Text:='';
New(Next);
Cur^.Next:=Next;
Cur:=Next;
end;
procedure TForm1.Button12Click(Sender: TObject);
begin
While Cur^.Op='+' do // Next<>nil
Edit1.Text:=floatTostr(StrTofloat(Edit1.Text)+Cur^.Val);
end;
end.
请问如何才可以实现连算(+。-。*。/)按先后次序。该程序错在那里???谢谢~!