Dúvida rápida e simples: media duas notas.

Delphi

02/04/2016

Olá, sou iniciante, como se pode ver. Estou tentando calcular uma média em delphi xe8. Tá dando o seguinte erro de compilação:


[dcc32 Error] Unit1.pas(36): E2250 There is no overloaded version of 'StrToInt' that can be called with these arguments
<--Linha 34




unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    procedure Edit3Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Nota1, Nota2, Média: Integer;

implementation

{$R *.dfm}

procedure TForm1.Edit3Change(Sender: TObject);
begin
  Edit3.Text := (StrToInt(Média = Nota1 div Nota2));
end;

end.



.
[img]http://arquivo.devmedia.com.br/forum/imagem/480368-20160402-134441.png[/img]




Quem puder ajudar, agradeço.

Valew
Adriano Freitas

Adriano Freitas

Curtidas 0

Respostas

Raylan Zibel

Raylan Zibel

02/04/2016

unit Unit1;

interface

uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls;

type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure Edit3Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Edit3Change(Sender: TObject);
var
Nota1, Nota2, Media: Integer;
begin
Nota1 := StrToInt(Edit1.Text);
Nota2 := StrToInt(Edit2.Text);
Media := (Nota1 + Nota2) div 2;
Edit3.Text := IntToStr(Media);
end;

end.
GOSTEI 0
Raylan Zibel

Raylan Zibel

02/04/2016

Chame esse codigo num botão, não seria melhor?
GOSTEI 0
Adriano Freitas

Adriano Freitas

02/04/2016

Chame esse codigo num botão, não seria melhor?



Valeu irmão. Resolveu o meu problema e ainda aprendi um pouco.

Abraço!
GOSTEI 0
POSTAR