Вы находитесь на странице: 1из 15

Reinaldo Cotaa M.

UN BLOG CREADO PARA EL MEJOR APRENDIZAJE DE LA PROGRAMACION


BASICA CON DELPHI

viernes 15 de mayo de 2009


CONTRASEA UN NOMBRE UNA CONTRASEA

procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);


begin
IF KEY=#13 THEN
edit2.SetFocus
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
IF (LENGTH(EDIT1.Text)>0)AND(LENGTH(EDIT2.Text)>0)THEN
bitbtn1.Enabled:=TRUE
ELSE
bitbtn1.Enabled:=FALSE
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
IF (LENGTH(EDIT1.Text)>0)AND(LENGTH(EDIT2.Text)>0)THEN
bitbtn1.Enabled:=TRUE
ELSE
bitbtn1.Enabled:=FALSE
end;
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
IF((LOWERCASE(EDIT1.Text)='tengo')and(LOWERCASE(EDIT2.Text)='sueo'))the
n

begin
timer1.enabled:=False;
MESSAGEDLG('INGRESO AL SISTEMA CORRECTAMENTE'#13'BIENVENIDO
',MTINFORMATION,[mbOK],1);
close
end
else if FORM1.Tag<4>=4 THEN
BEGIN
TIMER1.ENABLED:=FALSE;
MESSAGEDLG('USUARIO NO AUTORIZADO',MTWARNING,[MbOK],1);
close
end
else
begin
FORM1.Tag:=FORM1.Tag+1;
EDIT1.SelStart:=0;
EDIT1.SelLength:=LENGTH(EDIT1.Text);
EDIT1.CLEAR;
EDIT2.CLEAR;
EDIT1.SetFocus
END;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
label4.Caption:='le resta '+inttostr(timer1.Tag)+' seg';
TIMER1.Tag:=TIMER1.Tag-1;
IF TIMER1.Tag=0 THEN
BEGIN
TIMER1.Enabled:=FALSE;
LABEL4.Caption:='';
APPLICATION.MessageBox('SE CERRARA EL SISTEMA',' TIEMPO
AGOTADO',MB_OK);
CLOSE
end;
end;
end.
Publicado por Reinaldo Cotaa en 06:02 0 comentarios

martes 12 de mayo de 2009


GRAFICOS EN DELPHI
begin
canvas.Pen.Color:=clgreen;

canvas.MoveTo(100,100);
canvas.LineTo(200,200);
canvas.Pen.Color:=clyellow;
Canvas.Brush.Color := clblue;
Canvas.Brush.Style := bsDiagCross;
Canvas.Ellipse(0, 0, Image1.Width, Image1.Height);
end;
begin
canvas.Pen.Color:=clyellow;
canvas.MoveTo(300,300);
canvas.LineTo(200,200);
end;
begin
Canvas.pen.Style:=pssolid;
canvas.Pen.Color:=clred;
Canvas.Brush.Color := clblue;
Canvas.Brush.style:=bsHorizontal ;

Polygon

canvas.
([point(400,400),point(400,500),point(500,500),point(500,500)]);
end;
begin
canvas.Pen.Color:=cllime;
Canvas.pen.Style:=psDashDotDot;
canvas.Arc(100,300,300,600,0,0,0,0);
end;
end;
end.
Publicado por Reinaldo Cotaa en 11:27 0 comentarios

viernes 1 de mayo de 2009


Salario con un aumento arriba de las 30 hr y in impuesto de 20

unit salario;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}

procedure TForm1.BitBtn1Click(Sender: TObject);


var tar,sal,num:real;
mane:string;
begin
tar:=strtofloat(edit1.Text);
num:=strtofloat(edit2.Text);
name:=(edit3.Text);
sal:=(tar*num);
if sal>100 then
begin
sal:=(tar*num)-tar*num*0.2;
//tar*num*0.2 es el impuesto del 20%;
edit4.Text:=floattostr(sal)+ ' Bs de sueldo de '+(name);
end
else
// condicionante indicando si elnumero de horas que setrabajanesmayor
//a 30 horas hay un aumento de 60% y tb descopntando elimpuesto;
if num>30 then
begin
sal:=(tar*num+tar*num*0.6-tar*num*0.2);
edit4.Text:=floattostr(sal); end
end;
// colocamoseste boton para que borre datos anteriores
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
edit1.Clear;
edit2.Clear;
edit3.Clear;
edit1.SetFocus;
// naden sus dudas en la misma pagina
end;
end.
Publicado por Reinaldo Cotaa en 06:36 0 comentarios

Multiplicacion de menores y divicion de mayores

unit Unit1;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure BitBtn1Click(Sender: TObject);
private { Private declarations }
public { Public declarations }
end;
var Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1ClickSender:TObject);
var
a:integer;
b:integer;
c:integer;
d:integer;
m,n:real;
begin
a:=StrToInt(Edit1.Text);
b:=StrToInt(Edit2.Text);
c:=StrToInt(Edit3.Text);
d:=StrToInt(Edit4.Text);

if((a>b) and (a>c) and (a>d))then


begin
if((b>c)and (b>d))then
begin
m:=a/b;
n:=c*d;
end;
else
begin
If((c>b)and (c>d))then
begin
m:=a/c;
n:=b*d;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
if((d>c)and(d>b))then
begin
m:=a/d;
n:=b*c;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end;
end;
end;
end
else
begin
if((b>a) and (b>c) and (b>d))then
begin//inicio
if((a>c)and (a>d))then
begin
m:=b/a;
n:=c*d;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
If((c>a)and (c>d))then
begin
m:=b/c;
n:=a*d;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end

else
begin
if((d>a)and(d>c))then
begin
m:=b/d;
n:=a*c; edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end;
end;
end;
end//fin
else
begin
if((c>a) and (c>b) and (c>d))then
begin//inicio
if((a>b)and (a>d))then
begin
m:=c/a;
n:=b*d;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
If((b>a)and (b>d))then
begin
m:=c/b;
n:=a*d;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
if((d>a)and(d>b))then
begin
m:=c/d;
n:=a*b;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end;
end;
end;
end//final
else
begin
if((d>a) and (d>b) and (d>c))then
begin//inicio
if((a>b)and (a>c))then

begin
m:=d/a;
n:=c*b;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
If((b>a)and (b>d))then
begin
m:=d/b;
n:=a*c;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end
else
begin
if((c>a)and(c>b))then
begin
m:=d/c;
n:=a*b;
edit5.Text:=FloatToSTR(n);
edit6.Text:=FloatToSTR(m);
end;
end;
end;
end;//final
end;
end;
end;
end;
end.
Publicado por Reinaldo Cotaa en 06:14 0 comentarios

jueves 23 de abril de 2009


EL MENOR DE 5 MUNEROS
unit el n menor;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls;
type
TForm1 = class(TForm)
GroupBox1: TGroupBox;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
procedure Button3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button3Click(Sender: TObject);
begin
CLOSE
end;
procedure TForm1.Button1Click(Sender: TObject);
VAR
a,b,c,d,e,min:real;
begin
try
a:= StrTofloat(Edit1.text);
b:= StrTofloat(Edit2.text);
c:= StrTofloat(Edit3.text);

d:= StrTofloat(Edit4.text);
e:= StrTofloat(Edit5.text);
min:= a;
If b < min then
min:= b;
If c < min then
min:= c;
If d < min then
min:= d;
If e < min then
min:= e;
Edit6.Text:=Floattostr(min);
except
on
EconvertError do ShowMessage(#9' ERROR EN LOS DATOS INGRESADOS ');
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit1.Clear;
Edit2.Clear;
Edit3.Clear;
Edit4.Clear;
Edit5.Clear;
Edit6.Clear;
Edit1.SetFocus;
end;

end
Publicado por Reinaldo Cotaa en 18:11 0 comentarios

DIST. 2 PTO'S ESFERICOS


unit distancia entre dos ptos coord. esfericas;
interface
uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,


Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit7: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
VAR a,b,c,d,e,f,x1,x2,y1,y2,z1,z2,dist:real;
begin
a:=0 ;
b:=0 ;
c:=0 ;
d:=0 ;
e:=0;
f:=0;
a:=strtofloat(edit1.Text);
b:=strtofloat(edit2.Text);
c:=strtofloat(edit3.Text);
d:=strtofloat(edit4.Text);
e:=strtofloat(edit5.Text);
f:=strtofloat(edit6.Text);
x1:=a*cos(pi*b/180)*cos(pi*c/180);
y1:=a*cos(pi*b/180)*sin(pi*c/180);
z1:=a*sin(pi*b/180);
x2:=d*cos(pi*e/180)*cos(pi*f/180);

y2:=d*cos(pi*e/180)*sin(pi*f/180);
z2:=d*sin(pi*e/180);
dist:=sqrt(sqr(x2-x1)+sqr(y2-y1)+sqr(y2-y1));
edit7.Text:=floattostr(dist);
end;
end.
Publicado por Reinaldo Cotaa en 18:07 0 comentarios

PROMEDIO NOTAS CON 7 ALUMNOS


program Project1;( promedio notas)
uses
dialogs,sysutils;
type estudiante=class
procedure iniciar(n:string;n1,n2,n3,n4,n5,n6,n7:real);
function media:real;
procedure mostrar;
private
nombre:string;
nota1,nota2,nota3,nota4,nota5,nota6,nota7:real;
end;
procedure estudiante.iniciar;
begin
nombre:=n;nota1:=n1;nota2:=n2;nota3:=n3;nota4:=n4;nota5:=n5;nota6:=n6;nota7:=n7
end;
function estudiante.media;
begin
media:=(nota1+nota2+nota3+nota4+nota5+nota6+nota7)/7;
end;
procedure estudiante.mostrar;
begin
showmessage(nombre+'ha obtenido en el promedio de 7 materias: '+floattostr(media));
end;
var e1,e2,e3,e4:estudiante;
begin
e1:=estudiante.create;
e2:=estudiante.create;
e3:=estudiante.create;
e4:=estudiante.create;
e1.iniciar('LINA ',15,68,59,64,89,97,100);e1.mostrar;
e2.iniciar('KEVIN ',15,68,59,64,89,97,100);e2.mostrar;
e3.iniciar('VICTOR ',15,68,59,64,89,97,100);e3.mostrar;
e4.iniciar('MAURICIO ',15,68,59,64,89,97,100);e4.mostrar;
END.
Publicado por Reinaldo Cotaa en 18:05 0 comentarios
Entradas antiguas Pgina principal
Suscribirse a: Entradas (Atom)

ALGUNO DE ESTOS PROGRAMAS NO CORRE?


Seguidores
Archivo del blog

2009 (11)
o mayo (4)

CONTRASEA UN NOMBRE UNA CONTRASEA

GRAFICOS EN DELPHI

Salario con un aumento arriba de las 30 hr y in im...

Multiplicacion de menores y divicion de mayores

o abril (6)

EL MENOR DE 5 MUNEROS

DIST. 2 PTO'S ESFERICOS

PROMEDIO NOTAS CON 7 ALUMNOS

INSTRUCCIONES

PROGRAMA CAMBIO DE MONEDA

PORGRAMA SALUDO

o marzo (1)

Delphi

Datos personales
Reinaldo Cotaa
Ver todo mi perfil

Вам также может понравиться