永发信息网

delphi if

答案:2  悬赏:0  手机版
解决时间 2021-03-20 21:55
  • 提问者网友:记得曾经
  • 2021-03-20 00:26
procedure TForm1.Button1Click(Sender: TObject);
begin
if (edit1.Text='')or(edit2.Text='') then begin
messagebox(application.Handle,pchar(
'编辑框1和编辑框2的内容不能为空!'),pchar('提示'),MB_OK);
end else begin if radiobutton1.checked=true then begin
edit3.Text:=inttostr(strtoint(edit1.Text)+strtoint(edit2.Text));
end else begin if radiobutton2.Checked=true then begin
edit3.Text:=inttostr(strtoint(edit1.Text)-strtoint(edit2.Text));
end;
end;

end.

老实显示最后一样错误,麻烦高手帮我看下代码!
最佳答案
  • 五星知识达人网友:神鬼未生
  • 2021-03-20 02:05
少了两个end;begin和end要配对出现,根本就不需要用到那么多的begin..end
改成这样就可以啦!最后希望你养成书写代码的规范性习惯

procedure TForm1.Button1Click(Sender: TObject);
begin
if (edit1.Text='') or (edit2.Text='') then
messagebox(application.Handle,pchar('编辑框1和编辑框2的内容不能为空!'),pchar('提示'),MB_OK)
else if radiobutton1.checked then
edit3.Text := inttostr(strtoint(edit1.Text)+strtoint(edit2.Text))
else if radiobutton2.Checked then
edit3.Text := inttostr(strtoint(edit1.Text)-strtoint(edit2.Text));
end;
全部回答
  • 1楼网友:十鸦
  • 2021-03-20 02:18
你好! 什么错误啊?贴出来看看 仅代表个人观点,不喜勿喷,谢谢。
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯