跪求一个用delphi7做的计算器,能实现基本加减乘除基本功能。选修课作业,急用。。。谢谢

不要代码,只要整个程序源文件,能直接运行。631494304@qq.com... 不要代码,只要整个程序源文件,能直接运行。

631494304@qq.com
展开
 我来答
熊冰昳5B
2012-12-02 · TA获得超过490个赞
知道小有建树答主
回答量:632
采纳率:0%
帮助的人:460万
展开全部
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TForm1 = class(TForm)
Panel1: TPanel;
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;
Edit1: TEdit;
SpeedButton17: TSpeedButton;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton12Click(Sender: TObject);
procedure SpeedButton13Click(Sender: TObject);
procedure SpeedButton17Click(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
Flag: Boolean = True; //。标记位
Flag1: Integer = 1; //计算方法标志位
num1, num2, result: Real;
flagresult: Boolean = False;
procedure TForm1.SpeedButton1Click(Sender: TObject);
var
str: string;
begin
str := Edit1.Text;
if (Length(str) = 1) and (str = '0') then
Edit1.Clear;
Edit1.Color := clBlue;
if ((Sender as TSpeedButton).Caption = '.') then
begin
if Flag then
begin
Edit1.Text := Edit1.Text + (sender as TSpeedButton).Caption;
Flag := False;
end
end
else
Edit1.Text := Edit1.Text + (sender as TSpeedButton).Caption;
end;
procedure TForm1.SpeedButton12Click(Sender: TObject);
begin
Edit1.Color := clRed;
num2 := StrToFloatDef(Edit1.Text, 0.00);
case Flag1 of
1: result := num1 + num2;
2: result := num1 - num2;
3: result := num1 * num2;
4: if num2 = 0 then
begin
MessageBox(0, '除数为0', '', 0);
result := 0;
end
else
result := num1 / num2;
end;
Edit1.Text := FloatToStr(result);
end;
procedure TForm1.SpeedButton13Click(Sender: TObject);
begin
Flag1 := (Sender as TSpeedButton).Tag;
num1 := StrToFloatDef(Edit1.Text, 0.00);
Edit1.Text := '0';
end;
procedure TForm1.SpeedButton17Click(Sender: TObject);
begin
Flag := True; //。标记位
Flag1 := 1; //计算方法标志位
num1 := 0;
num2 := 0;
result := 0;
Edit1.Text := '0';
end;
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
case key of
'1': SpeedButton1.Click;
'2': SpeedButton2.Click;
'3': SpeedButton3.Click;
'4': SpeedButton4.Click;
'5': SpeedButton5.Click;
'6': SpeedButton6.Click;
'7': SpeedButton7.Click;
'8': SpeedButton8.Click;
'9': SpeedButton9.Click;
'0': SpeedButton10.Click;
'.': SpeedButton11.Click;
'+': SpeedButton13.Click;
'-': SpeedButton14.Click;
'*': SpeedButton15.Click;
'/': SpeedButton16.Click;
end;
end;
end.
追问
很感谢有代码,但表示建筑学的看不懂,根本不会用这软件,有没有可以直接运行的?
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
怀海之0P
2012-12-12
知道答主
回答量:3
采纳率:0%
帮助的人:3万
展开全部
已发 而且是比较专业的科学计算器
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
liu55721
2012-12-02 · TA获得超过922个赞
知道大有可为答主
回答量:1861
采纳率:100%
帮助的人:866万
展开全部
很简单的,自己做吧,会写代码的人是没有这闲功夫做这没有用处的玩意儿的.除非你给点钱.
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 2条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式