鱼C论坛

 找回密码
 立即注册
查看: 2676|回复: 4

遇到问题了。

[复制链接]
发表于 2012-8-1 09:33:24 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

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

   学DELPHI到第四课,可爱的鱼老师要叫做个计算器,我把界面都做好了,结果发现进行不下去了!!

                               
登录/注册后可看大图


目前问题如下:
  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.


想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2012-8-1 11:07:43 | 显示全部楼层
图片挂了。把源码发上来。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
发表于 2012-8-3 01:58:04 | 显示全部楼层
老兄我上面的没看就看最后一句Edit1.Text:=FloatToStr(StrToFloat(a)+StrToFloat(Edit1.Text));,这个也太矛盾了吧,第一个先把浮点型转化为字符型,第二句却把字符型转化为浮点型
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
 楼主| 发表于 2013-8-14 19:53:01 | 显示全部楼层
我怎么还是新鱼友呢?:cry
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-7-25 19:57:43 | 显示全部楼层
我来看看
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-11-22 16:40

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表