Ver Mensaje Individual
  #1  
Antiguo 24-03-2007
Avatar de jose91-welva
jose91-welva jose91-welva is offline
Miembro
 
Registrado: mar 2007
Posts: 10
Reputación: 0
jose91-welva Va por buen camino
Unhappy Ayuda con Random

Hola¡¡ Estoi haciendo un programilla y haber si me podeis ayudar por que en unas prácticas me dijeron escribier eso para otro programa pero para este no se que tengo que cambiar haber si m podeis ayudar a corregirlo y a ver si m podeis explicar su sintaxis. Aí va el códifo entero x si acaso:

Código Delphi [-]
unit Unit1;
 
interface
 
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
 
type
      TForm1 = class(TForm)
      Label1: TLabel;
      Label2: TLabel;
      Label3: TLabel;
      Edit1: TEdit;
      procedure Label3Click(Sender: TObject);
      procedure Label1Click(Sender: TObject);
      private
{ Private declarations }
public
{ Public declarations }
end;
 
var
      Form1: TForm1;
      X: array[1..100] of byte;
 
implementation
 
{$R *.dfm}
 
procedure TForm1.Label1Click(Sender: TObject);
begin
Label1.Caption:= X[round(random(100))];
end;
 
procedure TForm1.Label3Click(Sender: TObject);
begin
Label2.Caption:= X[round(random(100))]
end;
 
end.

El error me aparece en:

Código Delphi [-]
Label1.Caption:= X[round(random(100))];

y en:

Código Delphi [-]
Label2.Caption:= X[round(random(100))];

En los mensages pone:

Código:
[Pascal Error] Unit1.pas(32):E2010 Incompatible types: 'string' and 'byte'
eso lo he puesto para que salga un número aleatorio. Creo que más claro no podia ser Enga un saludo

Última edición por dec fecha: 24-03-2007 a las 14:36:05.
Responder Con Cita