Answer the question
In order to leave comments, you need to log in
Error: Operator is not overloaded: "Real" mod "Real"?
Hello everyone
, I don’t understand why the error unit1.pas (75,13) Error: Operator is not overloaded: "Real" mod "Real"
in programming, I do not
thank you very much in advance
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
private
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var a, b, s: real;
begin
a := StrToFloat(Edit1.Text);
b := StrToFloat(Edit2.Text);
s:= a+b;
ShowMessage('a+b)= '+FloatTostr(s)+' ' );
end;
procedure TForm1.Button2Click(Sender: TObject);
var a, b, r: real;
begin
a := StrToFloat(Edit1.Text);
b := StrToFloat(Edit2.Text);
r:= a-b;
ShowMessage('a-b)= '+FloatTostr(r)+' ' );
end;
procedure TForm1.Button3Click(Sender: TObject);
var a, b, d: real;
begin
a := StrToFloat(Edit1.Text);
b := StrToFloat(Edit2.Text);
d:= a/b;
ShowMessage('a/b)= '+FloatTostr(d)+' ' );
end;
procedure TForm1.Button4Click(Sender: TObject);
var a, b: real; v: double;
begin
a := StrToFloat(Edit1.Text);
b := StrToFloat(Edit2.Text);
v := a mod b; // здесь ошибка
ShowMessage('a%b)= '+FloatTostr(v)+' ' );
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
end;
end.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question