早教吧作业答案频道 -->其他-->
用delphi科学计算器设计制作一个类似于Windows操作系统附件中所带的计算器程序,该程序具有标准型和科学型两大功能.系统功能要求1.标准型计算器,主要具有能进行加减乘出和求余等基本的
题目详情
用delphi科学计算器设计
制作一个类似于Windows操作系统附件中所带的计算器程序,该程序具有标准型和科学型两大功能.系统功能要求1.标准型计算器,主要具有能进行加减乘出和求余等基本的计算功能.2.科学型计算器除具有全部标准型功能外,还具有三角函数计算,如正弦、余弦、正切和对数计算,如自然对数和常用对数,指数计算如平方、立方和任意次方计算,在统计计算中,具有求和、求平均数等功能.在科学计算中,除了十进制数计算以外,还具有十六进制、八进制和二进制计算功能,在三角函数运算中,支持角度和弧度两种单位.总之,功能基本上和操作系统中的计算器类似.
制作一个类似于Windows操作系统附件中所带的计算器程序,该程序具有标准型和科学型两大功能.系统功能要求1.标准型计算器,主要具有能进行加减乘出和求余等基本的计算功能.2.科学型计算器除具有全部标准型功能外,还具有三角函数计算,如正弦、余弦、正切和对数计算,如自然对数和常用对数,指数计算如平方、立方和任意次方计算,在统计计算中,具有求和、求平均数等功能.在科学计算中,除了十进制数计算以外,还具有十六进制、八进制和二进制计算功能,在三角函数运算中,支持角度和弧度两种单位.总之,功能基本上和操作系统中的计算器类似.
▼优质解答
答案和解析
部分源代码
s_result:='0';
result:=0;
point_flag:=false;
operation_symbol:=0;
input_2:=false;
display_refresh();
end;
procedure TForm1.Button15Click(Sender: TObject);
begin
operation_over:=true;
source_1:=strtofloat(s_source_1);
if input_2 then
begin
source_2:=strtofloat(s_source_2);
end
else
begin
// source_2:=source_1;
// s_source_2:=floattostr(source_2);
end;
case operation_symbol of
0:
begin
result:=source_1;
display_refresh();
exit;
end;
1:
begin
result:=source_1+source_2;
display_refresh();
end;
2:
begin
result:=source_1-source_2;
display_refresh();
end;
3:
begin
result:=source_1 * source_2;
display_refresh();
end;
4:
begin
if source_2 = 0 then
begin
messagebox(form1.Handle,'0 不能做除数','错误!',0);
exit;
end;
result:=source_1 / source_2;
display_refresh();
end;
end;
input_2:=false;
source_1:=result;
s_source_1:=floattostr(result);
s_source_2:='0';
point_flag:=false;
end;
procedure TForm1.Button19Click(Sender: TObject);
begin
if result>=0 then
begin
operation_over:=true;
result:=sqrt(result);
display_refresh();
if input_2=true then
begin
source_2:=result;
s_source_2:='0';
input_2:=false;
end
else
begin
s_source_1:=floattostr(result);
end;
end
else
begin
messagebox(form1.Handle,'负数不能开根号','错误!',0);
end;
end;
procedure TForm1.Button30Click(Sender: TObject);
begin
if (operation_symbol >0) and (input_2 = true) then
begin
button15.Click;
end;
operation_symbol:=1;
// source_2:=0;
// s_source_2:='0';
point_flag:=false;
operation_over:=false;
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
if (operation_symbol >0) and (input_2 = true) then
begin
button15.Click;
end;
operation_symbol:=2;
// source_2:=0;
// s_source_2:=floattostr(source_2);
point_flag:=false;
operation_over:=false;
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
if (operation_symbol >0) and (input_2 = true) then
begin
button15.Click;
end;
operation_symbol:=3;
// source_2:=0;
// s_source_2:=floattostr(source_2);
point_flag:=false;
operation_over:=false;
end;
procedure TForm1.Button12Click(Sender: TObject);
begin
if (operation_symbol >0) and (input_2 = true) then
begin
button15.Click;
end;
operation_symbol:=4;
// source_2:=0;
// s_source_2:=floattostr(source_2);
point_flag:=false;
operation_over:=false;
end;
procedure TForm1.Button24Click(Sender: TObject);
begin
if result 0 then
begin
operation_over:=true;
result:=1 / result;
display_refresh();
if input_2=true then
begin
source_2:=result;
s_source_2:='0';
input_2:=false;
end
else
begin
s_source_1:=floattostr(result);
end;
end
else
begin
messagebox(form1.Handle,'0 不能求倒数','错误!',0);
end;
end;
procedure TForm1.Button28Click(Sender: TObject);
begin
if input_2 = true then
begin
s_source_2:='0';
source_2:=0;
result:=0;
display_refresh();
end
else
begin
s_source_1:='0';
source_1:=0;
result:=0;
display_refresh();
end;
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
result:=(-1)*result;
if input_2 then
begin
source_2:=result;
s_source_2:=floattostr(source_2);
end
else
begin
s_source_1:=floattostr(result);
end;
display_refresh();
end;
procedure TForm1.Button27Click(Sender: TObject);
begin
if input_2 = false then
begin
if length(s_source_1)>2 then
begin
delete(s_source_1,length(s_source_1),1);
result:=strtofloat(s_source_1);
display_refresh();
exit;
end;
if length(s_source_1)
s_result:='0';
result:=0;
point_flag:=false;
operation_symbol:=0;
input_2:=false;
display_refresh();
end;
procedure TForm1.Button15Click(Sender: TObject);
begin
operation_over:=true;
source_1:=strtofloat(s_source_1);
if input_2 then
begin
source_2:=strtofloat(s_source_2);
end
else
begin
// source_2:=source_1;
// s_source_2:=floattostr(source_2);
end;
case operation_symbol of
0:
begin
result:=source_1;
display_refresh();
exit;
end;
1:
begin
result:=source_1+source_2;
display_refresh();
end;
2:
begin
result:=source_1-source_2;
display_refresh();
end;
3:
begin
result:=source_1 * source_2;
display_refresh();
end;
4:
begin
if source_2 = 0 then
begin
messagebox(form1.Handle,'0 不能做除数','错误!',0);
exit;
end;
result:=source_1 / source_2;
display_refresh();
end;
end;
input_2:=false;
source_1:=result;
s_source_1:=floattostr(result);
s_source_2:='0';
point_flag:=false;
end;
procedure TForm1.Button19Click(Sender: TObject);
begin
if result>=0 then
begin
operation_over:=true;
result:=sqrt(result);
display_refresh();
if input_2=true then
begin
source_2:=result;
s_source_2:='0';
input_2:=false;
end
else
begin
s_source_1:=floattostr(result);
end;
end
else
begin
messagebox(form1.Handle,'负数不能开根号','错误!',0);
end;
end;
procedure TForm1.Button30Click(Sender: TObject);
begin
if (operation_symbol >0) and (input_2 = true) then
begin
button15.Click;
end;
operation_symbol:=1;
// source_2:=0;
// s_source_2:='0';
point_flag:=false;
operation_over:=false;
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
if (operation_symbol >0) and (input_2 = true) then
begin
button15.Click;
end;
operation_symbol:=2;
// source_2:=0;
// s_source_2:=floattostr(source_2);
point_flag:=false;
operation_over:=false;
end;
procedure TForm1.Button13Click(Sender: TObject);
begin
if (operation_symbol >0) and (input_2 = true) then
begin
button15.Click;
end;
operation_symbol:=3;
// source_2:=0;
// s_source_2:=floattostr(source_2);
point_flag:=false;
operation_over:=false;
end;
procedure TForm1.Button12Click(Sender: TObject);
begin
if (operation_symbol >0) and (input_2 = true) then
begin
button15.Click;
end;
operation_symbol:=4;
// source_2:=0;
// s_source_2:=floattostr(source_2);
point_flag:=false;
operation_over:=false;
end;
procedure TForm1.Button24Click(Sender: TObject);
begin
if result 0 then
begin
operation_over:=true;
result:=1 / result;
display_refresh();
if input_2=true then
begin
source_2:=result;
s_source_2:='0';
input_2:=false;
end
else
begin
s_source_1:=floattostr(result);
end;
end
else
begin
messagebox(form1.Handle,'0 不能求倒数','错误!',0);
end;
end;
procedure TForm1.Button28Click(Sender: TObject);
begin
if input_2 = true then
begin
s_source_2:='0';
source_2:=0;
result:=0;
display_refresh();
end
else
begin
s_source_1:='0';
source_1:=0;
result:=0;
display_refresh();
end;
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
result:=(-1)*result;
if input_2 then
begin
source_2:=result;
s_source_2:=floattostr(source_2);
end
else
begin
s_source_1:=floattostr(result);
end;
display_refresh();
end;
procedure TForm1.Button27Click(Sender: TObject);
begin
if input_2 = false then
begin
if length(s_source_1)>2 then
begin
delete(s_source_1,length(s_source_1),1);
result:=strtofloat(s_source_1);
display_refresh();
exit;
end;
if length(s_source_1)
看了用delphi科学计算器设计制...的网友还看了以下:
按照发音给单词分类(f)actory(p)lay(ph)otobi(k)e(p)ianool(d) 2020-05-15 …
求助高一数学:两个事件E,F,P(F|E)=0.45,比较P(非F|E)与0.55的大小1.两个事 2020-06-10 …
对于平行反应,A→P(主反应),A→S(副反应)主副反应均为二级不可逆反应,若E主>E副,为了提高 2020-06-17 …
RAS中e*d=1(mod(p-1)*(q-1))密钥对的产生:选择两个大素数,p和q.计算:n= 2020-06-20 …
条件概率问题P(E|F)=P(EF)/P(F)这个是如何从最原始的公式推导出来的?另外P(EF)我 2020-07-09 …
药学植物学3道多选题,3、苔藓植物的主要化学成分有()A、脂类B、烃类C、萜类D、生物碱类E、黄酮 2020-07-12 …
设g(x)=px-q/x-2f(x),其中f(x)=lnx,且g(e)=qe-p/e-2.(e为自 2020-08-02 …
设随机变量E的分布列为P{E=k}=k/15,k=1,2,3,4,5.试求:P{E=1或E=2};P 2020-11-03 …
二阶微分方程求解题目2xy''=y'令p=y',则y''=p'=>2xp'=p=>2*dp/p=dx 2020-11-16 …
供给弹性表示某一商品的供给量对其本身价格变动的反应程度,其公式为:E=Q/P(E是供给弹性,Q是供给 2021-01-08 …