下面的程序出现的错误是
[Error] INPUTBOX.pas(36): '.' expected but '(' found //光标停在inputbox的左括号后面
[Error] INPUTBOX.pas(37): '.' expected but '(' found
[Error] INPUTBOX.pas(38): '.' expected but '(' found
[Error] INPUTBOX.pas(38): There is no overloaded version of 'StrToFloat' that can be called with these arguments
[Error] INPUTBOX.pas(41): Incompatible types: 'String' and 'Integer'
[Error] INPUTBOX.pas(42): Incompatible types: 'String' and 'Extended'
[Fatal Error] Project_InputBox.dpr(5): Could not compile used unit 'INPUTBOX.pas'全部程序代码为:
unit INPUTBOX;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
uses QDialogs;procedure TForm1.Button1Click(Sender: TObject);
var
Str1:string;
Int1:integer;
flo1:double;
begin
Str1 := InputBox('输入窗口1','请输入字符串','默认的字符串');
Int1 := StrToInt(inputbox('输入窗口2','请输入整数','123'));
Flo1 := StrToFloat(inputbox('输入窗口3','请输入双精度实数','123.456'));
label1.Caption:='测试输入窗口:'+#10#13+
'输入的字符串是:'+Str1+#10#13+
'输入的整数是:'+Int1+#10#13+
'输入的实数是:'+flo1;
end;
end.
[Error] INPUTBOX.pas(36): '.' expected but '(' found //光标停在inputbox的左括号后面
[Error] INPUTBOX.pas(37): '.' expected but '(' found
[Error] INPUTBOX.pas(38): '.' expected but '(' found
[Error] INPUTBOX.pas(38): There is no overloaded version of 'StrToFloat' that can be called with these arguments
[Error] INPUTBOX.pas(41): Incompatible types: 'String' and 'Integer'
[Error] INPUTBOX.pas(42): Incompatible types: 'String' and 'Extended'
[Fatal Error] Project_InputBox.dpr(5): Could not compile used unit 'INPUTBOX.pas'全部程序代码为:
unit INPUTBOX;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.dfm}
uses QDialogs;procedure TForm1.Button1Click(Sender: TObject);
var
Str1:string;
Int1:integer;
flo1:double;
begin
Str1 := InputBox('输入窗口1','请输入字符串','默认的字符串');
Int1 := StrToInt(inputbox('输入窗口2','请输入整数','123'));
Flo1 := StrToFloat(inputbox('输入窗口3','请输入双精度实数','123.456'));
label1.Caption:='测试输入窗口:'+#10#13+
'输入的字符串是:'+Str1+#10#13+
'输入的整数是:'+Int1+#10#13+
'输入的实数是:'+flo1;
end;
end.
解决方案 »
- 解释说明明一下
- adoquery.requery的方法如何使用,请详细一点,谢谢!
- 4000寻DELPHI程序员
- http://www.qqst.com/film/film.asp?id=fanhongbin1979 全国最优秀的免费电影网站之一,进来顶多后悔一时,不进来可能会后悔终生哦:)
- 不是问题的大问题
- 求救:TNMSMTP如何发送邮件???出现“需要SMTP认证”错误怎么解决???
- winnote文档收集管理软件1.2版正式发布(免费)工具软件,希望对大家有所帮助
- [转帖]免费100M ASP空间申请(附攻略)
- 怎样才能(什么事件)知道数据集字段在网格中弹出的小窗口的弹出和关闭事件?加分没商量!
- MS Agent
- webservice提示The operation timed out
- 如何获取另外程序中SysListView32组件的内容
'输入的整数是:'+InttoStr(Int1)+#10#13+
'输入的实数是:'+FloattoStr(flo1);
....
'输入的整数是:'+InttoStr(Int1)+#10#13+
'输入的实数是:'+FloattoStr(flo1);
....
字符格式要转换的。在DELPHI里面输入的字符要按你的定义类型来转换的。建议你多看DELPHI的基础书籍。
Str1 := InputBox('输入窗口1','请输入字符串','默认的字符串');
Int1 := StrToInt(inputbox('输入窗口2','请输入整数','123'));
Flo1 := StrToFloat(inputbox('输入窗口3','请输入双精度实数','123.456'));
label1.Caption:='测试输入窗口:'+#10#13+
'输入的字符串是:'+Str1+#10#13+
'输入的整数是:'+Int1+#10#13+
'输入的实数是:'+flo1;
Int1 := StrToInt(inputbox('输入窗口2','请输入整数','123'));
Flo1 := StrToFloat(inputbox('输入窗口3','请输入双精度实数','123.456'));
label1.Caption:='测试输入窗口:'+#10#13+
'输入的字符串是:'+Str1+#10#13+
'输入的整数是:'+IntToStr(Int1)+#10#13+
'输入的实数是:'+FloatToStr(flo1);注意类型的换转 IntToStr(Int1)+# ; FloatToStr(flo1);