delphi逻辑判断选择?
做的小游戏,不知是哪个地方出错了?代码:unitUnit1;interfaceusesWindows,Messages,SysUtils,Variants,Classes...
做的小游戏,不知是哪个地方出错了?代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
n1,n2:integer;
begin
n1:=strtoint(inputbox('武力指数','请输入数值','100'));
n2:=strtoint(inputbox('武力指数','请输入数值','100'));
case n2 of
if(n1>=250)then
showmessage('游戏即将开始')
else
showmessage('第一关不是你这种小混凝土混凝土在玩的'+chr(13)+'回去在练练吧。')
if (n1>=340)then
showmessage('勇者继续前进吧')
else
showmessage('少年仔,爱惜生命吧')
if(n1>=510)then
showmessage('你有必死的需在吗?'+chr(13)+'魔王在等你了')
else
showmessage('不敢闯关吗?');
end;
end. 展开
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
n1,n2:integer;
begin
n1:=strtoint(inputbox('武力指数','请输入数值','100'));
n2:=strtoint(inputbox('武力指数','请输入数值','100'));
case n2 of
if(n1>=250)then
showmessage('游戏即将开始')
else
showmessage('第一关不是你这种小混凝土混凝土在玩的'+chr(13)+'回去在练练吧。')
if (n1>=340)then
showmessage('勇者继续前进吧')
else
showmessage('少年仔,爱惜生命吧')
if(n1>=510)then
showmessage('你有必死的需在吗?'+chr(13)+'魔王在等你了')
else
showmessage('不敢闯关吗?');
end;
end. 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询