第一次,创建窗体
mAccumulator:=0;
nAccumulator:=0;
nDecimal:=0;
nPreviousOperation:=0;
nClear:=false;
点击按钮走到else里
nAccumulator:=0;
nDecimal:=1;
第二次nDecimal>0,结果
nAccumulator=1;
nDecimal=10;
第三次nDecimal>0,结果
nAccumulator = nAccumulator+1.0/nDecimal = 1+1.0/10=1.1
nDecimal := 100;
第四次nDecimal>0,结果
nAccumulator = nAccumulator+1.0/nDecimal=1.1+1.0/100=1.11
nDecimal := 1000;
第五次nDecimal>0,结果
nAccumulator = nAccumulator+1.0/nDecimal=1.11+1.0/1000=1.111
nDecimal := 10000;
至于第五次为什么是1.1,我也不知道了,是不是程序某个地方改变了nClear=ture;使得执行ClearEntry(),又重新将nAccumulator,nDecimal置0,重新循环
mAccumulator:=0;
nAccumulator:=0;
nDecimal:=0;
nPreviousOperation:=0;
nClear:=false;
点击按钮走到else里
nAccumulator:=0;
nDecimal:=1;
第二次nDecimal>0,结果
nAccumulator=1;
nDecimal=10;
第三次nDecimal>0,结果
nAccumulator = nAccumulator+1.0/nDecimal = 1+1.0/10=1.1
nDecimal := 100;
第四次nDecimal>0,结果
nAccumulator = nAccumulator+1.0/nDecimal=1.1+1.0/100=1.11
nDecimal := 1000;
第五次nDecimal>0,结果
nAccumulator = nAccumulator+1.0/nDecimal=1.11+1.0/1000=1.111
nDecimal := 10000;
至于第五次为什么是1.1,我也不知道了,是不是程序某个地方改变了nClear=ture;使得执行ClearEntry(),又重新将nAccumulator,nDecimal置0,重新循环
解决方案 »
- 字段获取控件的问题
- 程序安装包制作问题
- 讨论:delphi有没有做.net的web应用的能力
- 有关怎样运行字符串中的函数的问题
- 高手請進,郁悶!
- 这样的报表效果如何实现:每5行用不同的背景和前景颜色(比如1~5行用白色,6~10行用绿色,11~15行用白色,依次类推)100分求教
- 有没有人知道怎样让MDI的子窗口只打开一个!
- {88888888-8888-8888-8888-888888888888}象这样是怎么加密的?怎样解密?难道没人懂吗?
- 如何在delphi中自定义一个类,该类不继承任何类
- 软件莫名其妙卡死问题,请帮忙提供下思路。。。急西急
- ★★★用Toolbar组件制作工具拦的一个问题。■◆■●
- 公司要让有一年Delphi开发经验的我改用JAVA开发应用程序,也就是Application,而且是有一定规模的,原来Delphi代码就30万行,心烦,放分
begin
nAccumulator:= nAccumulator+1.0/nDecimal;
nDecimal:=nDecimal*10;
end
else
begin
nAccumulator:= nAccumulator*10;
nDecimal:=nDecimal+1;
end;
程序主要在这里执行,窗口初始化nAccumulator:=0;nDecimal:=0;
所以第一次执行nAccumulator:= nAccumulator*10;
nDecimal:=nDecimal+1;结果
nAccumulator=0,nDecimal=1;第二次---第五次执行nAccumulator:= nAccumulator+1.0/nDecimal;
nDecimal:=nDecimal*10;
所以
第二次,nAccumulator=1,nDecimal=10
第三次nAccumulator=1.1,nDecimal=100
第四次nAccumulator=1.11,nDecimal=1000
第五次nAccumulator=1.111,nDecimal=10000