第一次摸delphi 我.......
通常
if 表达式 then
语句1
else
语句2;
根据语法,语句1后面不能有; 如果加了会怎么样?????如果我if then后面要跟不止一个语句1,还要有语句3 4....要怎么写???以上是最重要的问题还有就是我做计算器的时候
if last='0' then
first:='除数不能为o' //之后first的内容会输出到editi这个文本框中
else
first:=floattostr(strtofloat(first)/strtofloat(last));运行的时候 比如输入2/0 他就直接报错异常了。
如果在 first:='除数不能为o'加上 ;
实验的时候 输入2/0 editi显示仍是2,我不知道计算了没有。。然后归零下(计算器通常有这个归零的键的吧)再做 editi 2/0 显示就得到了 除数不能为o这究竟是为什么????!!!
通常
if 表达式 then
语句1
else
语句2;
根据语法,语句1后面不能有; 如果加了会怎么样?????如果我if then后面要跟不止一个语句1,还要有语句3 4....要怎么写???以上是最重要的问题还有就是我做计算器的时候
if last='0' then
first:='除数不能为o' //之后first的内容会输出到editi这个文本框中
else
first:=floattostr(strtofloat(first)/strtofloat(last));运行的时候 比如输入2/0 他就直接报错异常了。
如果在 first:='除数不能为o'加上 ;
实验的时候 输入2/0 editi显示仍是2,我不知道计算了没有。。然后归零下(计算器通常有这个归零的键的吧)再做 editi 2/0 显示就得到了 除数不能为o这究竟是为什么????!!!
解决方案 »
- 那位大虾有关于tsslhttpcli与tsslhttpserver通讯的demo啊
- 谁有像软件安装的下一步/上一步的功能的控件
- 全局HOOK的千古之谜
- 我装的是delphi7企业版,没有samples选项卡
- 如何将一个整型对应的值 转换成ASCLL所对应的字符?如:int i := 32, 那么32对应的ASCLL是空格“ ”。急???
- 在本机如何获取网上一个论坛里某个表的数据记录?(暂时只有10分了^)
- 等不急了。。快来看看!!有分送
- 急用!!!怎么在Win9x下让Windows发声.(在线等.在线结贴)
- 我的文本文件(.txt)的图标不知怎么变成(.dll)的图标了,如何把它改回来???
- 怎样通过程序动态指定打印机?(通过打印机名)
- 求一可来回循环滚动的进度条代码或者控件
- 程序问题
begin
....;
....;
end else
begin
....;
if ... then
....;
....;
end;
if 1>0 then
begin
showmessage('1确实大于0');
end
else
begin
showmessage('太阳从西边出来了');
end; 2.
procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Length(MaskEdit1.Text)>30
then
begin
if Key=#8
then Button17.Click;
Key:=#0;
end; Form1.KeyPreview:=True;
if Key in ['1']
then Button1.Click
else if Key in['2']
then Button2.Click
else if Key in['3']
then Button3.Click
else if Key in['4']
then Button4.Click
else if Key in['5']
then Button5.Click
else if key in ['6']
then Button6.Click
else if Key in ['7']
then Button7.Click
else if key in ['8']
then Button8.Click
else if key in ['9']
then button9.Click
else if key in ['0']
then button10.Click
else if Key=#107
then Button13.Click
else if Key=#109
then Button14.Click
else if Key=#106
then Button15.Click
else if Key=#111
then Button16.Click
else if Key in [#103,#13,#187]
then Button20.Click
else if Key =#8
then Button17.Click
else if Key =#46
then button18.Click;
end;
这是你的算法问题
if 表达式 then
begin
语句1;
语句2;
语句3;
语句4;
语句5;
语句6;
end
else if 表达式 then
begin
语句1;
语句2;
语句3;
语句4;
语句5;
语句6;
end
else
begin
语句1;
语句2;
语句3;
语句4;
语句5;
语句6;
end
begin
showmessage('a>b');
end else
if a<b then
begin
showmessage('a<b');end else
begin
showmessage('a=b');
end;