问题1:
编写一个做算术题的程序,程序的设计界面如图3-3所示。程序执行时,单击【出题】按钮,将随机产生100以内的非负加数和被加数,当在等号“=”右边的方框里写出正确答案后,单击【结果】按钮,将显示“答案正确”;如果输入的答案不正确,将显示“答案错误”。
那个随机产生的数怎么做啊????
问题2:
正切函数怎么使用阿,我想实现输入一个数,单击按钮后,输出正切值
解决方案 »
- 关于CreateFileMapping的参数问题
- C/S Soekct编程问题。S端提示C已经断开,为什么C端还是连接状态?
- 关于dbgrideh的下拉列表问题.高手请进,马上揭帖.急...
- 凡是使用的是SQL SERVER 2000中的表,它都找不到字段,不知为何?
- 请问那里有windows 95 的安装程序?我的分不多了,答对者每人十分吧!谢谢了!
- 问两个问题
- 关于文件流抱错的问题,
- 用Delphi好吗?
- 从现CSDN,请多多关照,版主请不要删!
- 菜鸟想问怎么用程序计算:现在是2002-06-15 7:49:25,那么8小时以前是几点呢?
- 帮帮看一下,谁能告诉我:如何用流加载HTML网页中的图片!
- 酒店管理的房态表怎么实现
下面是Delphi中的例子
var
I: Integer;
begin
Randomize;
for I := 1 to 50 do begin
{ Write to window at random locations }
Canvas.TextOut(Random(Width), Random(Height), 'Boo!');
end;
end;
var
i: integer;
begin
Randomize;
for i:=0 to 100 do
begin
Edit1.Text := IntToStr(Random(i));
Edit2.Text := IntToStr(Random(i));
end;
end;procedure TForm1.Button1Click(Sender: TObject); //查看结果
begin
if (StrToInt(Edit1.Text)+StrToInt(Edit2.Text)=StrToInt(Edit3.Text)) then
ShowMessage('正确')
else
ShowMessage('错误');
end;至于正切,你直接用tan函数啊,Uses Math
var
i: integer;
begin
Randomize;
Edit1.Text := IntToStr(Random(i));
Edit2.Text := IntToStr(Random(i));
end;
end;procedure TForm1.Button2Click(Sender: TObject); //查看结果
begin
if (StrToIntDef(Edit1.Text, 0)+StrToIntDef(Edit2.Text, 0)=StrToIntDef(Edit3.Text, 0)) then
ShowMessage('正确')
else
ShowMessage('错误');
end;