。Yh 发表于 2012-8-1 09:33:24

遇到问题了。

本帖最后由 。Yh 于 2012-8-1 16:52 编辑

   学DELPHI到第四课,可爱的鱼老师要叫做个计算器,我把界面都做好了,结果发现进行不下去了!!
http://b155.photo.store.qq.com/psb?/V12CS05z1veRZd/7B1OaBxXS9GZowWC5CSTKdH.nwbuT6OsORpK1e8o30s!/b/YRdNbFxQZAAAYkS1ZFwdbQAA

目前问题如下:
1、不知道怎么进行运算操作,只有一个EDIT,就搞不明白怎么算了,网上查,完全看不懂。
2、鱼老师说从后面输入,不知道怎么调,网上查完全看不懂。

代码在下面:
unit jishuanqi;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons, jpeg;
type
TForm1 = class(TForm)
    Image1: TImage;
    Edit1: TEdit;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SpeedButton3: TSpeedButton;
    SpeedButton4: TSpeedButton;
    SpeedButton5: TSpeedButton;
    SpeedButton6: TSpeedButton;
    SpeedButton7: TSpeedButton;
    SpeedButton8: TSpeedButton;
    SpeedButton9: TSpeedButton;
    SpeedButton10: TSpeedButton;
    SpeedButton11: TSpeedButton;
    SpeedButton12: TSpeedButton;
    SpeedButton13: TSpeedButton;
    SpeedButton14: TSpeedButton;
    SpeedButton15: TSpeedButton;
    SpeedButton16: TSpeedButton;
    SpeedButton17: TSpeedButton;
    SpeedButton18: TSpeedButton;
    SpeedButton19: TSpeedButton;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
    procedure SpeedButton3Click(Sender: TObject);
    procedure SpeedButton4Click(Sender: TObject);
    procedure SpeedButton5Click(Sender: TObject);
    procedure SpeedButton6Click(Sender: TObject);
    procedure SpeedButton7Click(Sender: TObject);
    procedure SpeedButton8Click(Sender: TObject);
    procedure SpeedButton9Click(Sender: TObject);
    procedure SpeedButton10Click(Sender: TObject);
    procedure SpeedButton12Click(Sender: TObject);
    procedure SpeedButton11Click(Sender: TObject);
    procedure SpeedButton13Click(Sender: TObject);
private
    { Private declarations }
public
    { Public declarations }
end;
var
Form1: TForm1;
a:string;
implementation
{$R *.dfm}
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Edit1.Text:=Edit1.text+'1';
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
Edit1.Text:=Edit1.text+'2';
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+'3';
end;
procedure TForm1.SpeedButton4Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+'4';
end;
procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+'5';
end;
procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+'6';
end;
procedure TForm1.SpeedButton7Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+'7';
end;
procedure TForm1.SpeedButton8Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+'8';
end;
procedure TForm1.SpeedButton9Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+'9';
end;
procedure TForm1.SpeedButton10Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+'0';
end;
procedure TForm1.SpeedButton12Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+'.';
end;
procedure TForm1.SpeedButton11Click(Sender: TObject);
begin
Edit1.Text:=Edit1.Text+'00';
end;
procedure TForm1.SpeedButton13Click(Sender: TObject);
begin
    a:=Edit1.Text;
    Edit1.Text:=FloatToStr(StrToFloat(a)+StrToFloat(Edit1.Text));
end;
end.


天空是黑的 发表于 2012-8-1 11:07:43

图片挂了。把源码发上来。

woawn 发表于 2012-8-3 01:58:04

老兄我上面的没看就看最后一句Edit1.Text:=FloatToStr(StrToFloat(a)+StrToFloat(Edit1.Text));,这个也太矛盾了吧,第一个先把浮点型转化为字符型,第二句却把字符型转化为浮点型

。Yh 发表于 2013-8-14 19:53:01

我怎么还是新鱼友呢?:cry

哥哥123 发表于 2015-7-25 19:57:43

我来看看
页: [1]
查看完整版本: 遇到问题了。