Olá pessoal,

Na linha ...:

  if strtoint(edit1. Text) mod 2 = 0 then
    label2.Caption := edit1.Text + ' o nº é par';

... tira o ';', para ficar assim:

  if strtoint(edit1. Text) mod 2 = 0 then
    label2.Caption := edit1.Text + ' o nº é par'
________________________________
Um abraço! Silvio Clécio
Contatos/Blog
Skype: silvioprog
Yahoo! Messenger: [EMAIL PROTECTED]
MSN (Hotmail): [EMAIL PROTECTED]
BlogSpot: http://silvioclecio.blogspot.com/



----- Mensagem original ----
De: Marcio Fernandes <[EMAIL PROTECTED]>
Para: delphi-br@yahoogrupos.com.br
Enviadas: Terça-feira, 14 de Outubro de 2008 15:58:36
Assunto: [delphi-br] Erro em if's


to com um peq pro no meu estudo aki, ele da o seg ero:

[Error] Unit1.pas(53) : ';' not allowed before 'ELSE'

o cod a minha unit é:
unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;
type
  TForm1 = class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    GroupBox1: TGroupBox;
    Label2: TLabel;
    Edit3: TEdit;
    Edit2: TEdit;
    Label5: TLabel;
    Label4: TLabel;
    Label3: TLabel;
    RadioButton1: TRadioButton;
    RadioButton2: TRadioButton;
    Edit4: TEdit;
    procedure Button1Click( Sender: TObject);
    procedure Edit1KeyPress( Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click (Sender: TObject);
var
  valoremreal : real;
  valordaraiz : real;
  parteinteira : real;
  partefracionaria : real;
begin
  valoremreal := strtofloat(edit1. Text);
  valordaraiz := sqrt(valoremreal) ;
  edit2.Text := floattostr(valordar aiz);
  parteinteira := int(valordaraiz) ;
  partefracionaria := valordaraiz - parteinteira;
  if strtoint(edit1. Text) mod 2 = 0 then
    label2.Caption := edit1.Text + ' o nº é par';
   else
    label2.Caption := edit1.Text + ' o nº é ímpar';
  if partefracionaria = 0 then
    begin
      radiobutton1. Checked := true;
      edit3.Text := floattostr(parteint eira);
      edit1.Text := '0';
    end
   else
    begin
      radiobutton2. Checked := true;
      edit3.Text := floattostr(parteint eira);
      edit4.Text := floattostr(partefra cionaria) ;
    end;
end;
procedure TForm1.Edit1KeyPres s(Sender: TObject; var Key: Char);
begin
  if not (key in ['0'..'9']) then key := '0';
end;
end.    


      Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua 
cara @ymail.com ou @rocketmail.com.
http://br.new.mail.yahoo.com/addresses

[As partes desta mensagem que não continham texto foram removidas]

Responder a