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

02/04/2016

0

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

Responder

Posts

02/04/2016

Raylan Zibel

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.
Responder

02/04/2016

Raylan Zibel

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

02/04/2016

Adriano Freitas

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



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

Abraço!
Responder

Que tal ter acesso a um e-book gratuito que vai te ajudar muito nesse momento decisivo?

Ver ebook

Recomendado pra quem ainda não iniciou o estudos.

Eu quero
Ver ebook

Recomendado para quem está passando por dificuldades nessa etapa inicial

Eu quero

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar