有人帮我解决这个错误.
[错误] Unit1.pas(39):运算符不适用于此操作数类型
代码是:
procedure TForm1.Button1Click(Sender: TObject);
var
k: Integer;
broj: Real;
begin
k := StrToInt(Edit1.Text);
if k <= 9 then
broj := k
else
broj := (k + 10) / 2;
if k mod 2 = 0 then
broj := broj / 10
else
broj := broj mod 10; // error line
ShowMessage(FloatToStr(broj));
end;
Run Code Online (Sandbox Code Playgroud) 我制作了一个程序,它不断告诉我输入的数字不是整数.
我正在进入100010110101,它弹出这个错误:
码:
procedure TForm1.Button1Click(Sender: TObject);
var
m,lo,cshl,cdhl,cjhl,csl,cdl,cjl:integer;
begin
m := StrToInt(Edit1.Text);
cshl := m div 100000000000;
cdhl := m div 10000000000 mod 10;
cjhl := m div 10000000000 mod 100;
csl := m div 1000000000 mod 1000;
cdl := m div 100000000 mod 10000;
cjl := m div 10000000 mod 100000;
lo := cjl + cdl * 10 + csl * 100 + cjhl * 1000 + cdhl * 10000 + cshl *100000;
ShowMessage(IntToStr(lo));
end;
Run Code Online (Sandbox Code Playgroud) 我无法解决这个问题,任何人都可以帮忙吗?
第1单元代码:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Form2; //error here
type
TForm1 = class(TForm)
Run Code Online (Sandbox Code Playgroud)
这是第2单元
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
CESTITAMO: TLabel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Rezultat11: TLabel;
REZULTAT21: TLabel;
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
end.
Run Code Online (Sandbox Code Playgroud)
是的,我创建了Form2,它的标题是"Cestitke!" 并保持名称为Form2
我想知道将来如何修复它,谢谢