procedure TForm1.Button1Click(Sender: TObject);
begin
a:=strtofloat(edit1.text);
b:=strtofloat(edit2.text);
c:=strtofloat(edit3.text);
d:=strtofloat(edit4.text);
g:=strtofloat(edit7.text);
h:=strtofloat(edit8.text);
i:=strtofloat(edit9.text);
j:=strtofloat(edit10.text);
k:=strtofloat(edit11.text);
l:=strtofloat(edit12.text);
edit6.Text:=FloatToStr((g-1)*(9*(1+0.02*a)*c)/((9*(1+0.02*a)*c)+(1+0.02*b)*d));
edit5.text:=FloatToStr(g-1-((g-1)*(9*(1+0.02*a)*c)/((9*(1+0.02*a)*c)+(1+0.02*b)*d)));
edit11.Text:=FloatToStr((g-1)*(9*(1+0.02*a)*h)/((9*(1+0.02*a)*h)+(1+0.02*b)*i));
edit10.text:=FloatToStr(g-1-((g-1)*(9*(1+0.02*a)*h)/((9*(1+0.02*a)*h)+(1+0.02*b)*i)));
edit13.text:=floattostr(strtofloat(edit5.Text)+strtofloat(edit10.Text ));
edit14.text:=floattostr(strtofloat(edit6.Text)+strtofloat(edit11.Text ));
end;
现在edit5、6、10、11是有小数的。用什么办法能得到整数
我是新手新手 Roundto()函数怎么运用。怎么输出到ini又怎么读取
追答1. Roundto(), math单元里。
RoundTo(1234567, 3) 1234000
RoundTo(1.234, -2) 1.23
2.直接写到一个文本文件里吧
{字符串写到文件}
procedure StringToFile (nString:string;mFileName:TFileName );
var
tFile:TextFile;
begin
AssignFile(tFile,mFileName );
Rewrite(tFile );
Write(tFile,nString);
CloseFile(tFile );
end;