您好,欢迎光临本网站![请登录][注册会员]  
文件名称: delphi计算器
  所属分类: Delphi
  开发工具:
  文件大小: 191byte
  下载次数: 0
  上传时间: 2012-07-14
  提 供 者: zhuyaz******
 详细说明: 用delphi做的计算器。unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Scr: TLabel; 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; Button1 6: TButton; Button17: TButton; Button18: TButton; Button19: TButton; Button20: TButton; procedure Button1Click(Sender: TObject); procedure Button12Click(Sender: TObject); procedure FormCreate(Sender: TObject); procedure Button11Click(Sender: TObject); procedure Button13Click(Sender: TObject); procedure Button20Click(Sender: TObject); procedure Button19Click(Sender: TObject); procedure Button18Click(Sender: TObject); private { Private declarations } pnt,er,fb:boolean; fstnm:Extended; fbcaption:string; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); var temp:string; begin if er then exit; if pnt then scr.Caption:=scr.Caption+(sender as Tbutton).Caption else if (scr.Caption='0.') or fb then begin scr.Caption:=(sender as Tbutton).caption+'.'; fb:=false; end else begin temp:=scr.Caption; insert((sender as Tbutton).Caption,temp,length(temp)); scr.Caption:=temp; end; end; procedure TForm1.Button12Click(Sender: TObject); var temp:string; begin if er then exit; if scr.Caption<>'0.' then if pos('-',scr.Caption)>0 then begin temp:=scr.Caption; delete(temp,1,1); scr.Caption:=temp; end else scr.Caption:='-'+scr.Caption; end; procedure TForm1.FormCreate(Sender: TObject); begin pnt:=false; fstnm:=0; fb:=false; fbcaption:=''; er:=false; end; procedure TForm1.Button11Click(Sender: TObject); begin if er then exit; pnt:=true; end; procedure TForm1.Button13Click(Sender: TObject); begin if er then exit; if not fb then button20click(nil); if er then exit; fstnm:=strtofloat(scr.Caption); fbcaption:=(sender as Tbutton).Caption; fb:=true; pnt:=false; end; procedure TForm1.Button20Click(Sender: TObject); begin if er then exit; if fbcaption='+' then begin scr.Caption:=floattostr(strtofloat(scr.Caption)+fstnm); end; if fbcaption='-' then begin scr.Caption:=floattostr(fstnm-strtofloat(scr.Caption)); end; if fbcaption='*' then begin scr.Caption:=floattostr(strtofloat(scr.Caption)*fstnm); end; if fbcaption='/' then begin if scr.Caption<>'0.' then scr.Caption:=floattostr(fstnm/strtofloat(scr.Caption)) else begin scr.Caption:='zero divid error!'; er:=true; end; end; if pos('.',scr.caption)=0 then scr.Caption:=scr.Caption+'.'; fb:=true; pnt:=false; fbcaption:=''; end; procedure TForm1.Button19Click(Sender: TObject); begin pnt:=false; fstnm:=0; fb:=false; fbcaption:=''; er:=false; scr.Caption:='0.'; end; procedure TForm1.Button18Click(Sender: TObject); begin if er then exit; scr.Caption:='0.'; end; end. ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 计算器
 输入关键字,在本站1000多万海量源码库中尽情搜索: