部分源代码
s_result:='0';
result:=0;
point_flag:=false;
operation_symbol:=0;
input_2:=false;
display_refresh();
end;
procedureTForm1.Button15Click(Sender:TObject);
begin
operation_over:=true;
source_1:=strtofloat(s_source_1);
ifinput_2then
begin
source_2:=strtofloat(s_source_2);
end
else
begin
//source_2:=source_1;
//s_source_2:=floattostr(source_2);
end;
caseoperation_symbolof
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
ifsource_2=0then
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;
procedureTForm1.Button19Click(Sender:TObject);
begin
ifresult>=0then
begin
operation_over:=true;
result:=sqrt(result);
display_refresh();
ifinput_2=truethen
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;
procedureTForm1.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;
procedureTForm1.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;
procedureTForm1.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;
procedureTForm1