Professional Documents
Culture Documents
PROGRAMA 1
CARACTERISTICAS PERSONALES
program caracteristicas_personales;
uses
forms, dialogs,sysutils;
begin
showmessage('hola mi nombre es juan'+#13+'me gusta jugar futbol');
showmessage('vivo en cercado'+#13+'estoy en ing civil');
showmessage('soy signo piscis'+#13+'peso 78 kg');
end.
PROGRAMA 2
DISTANCIA ENTRE 2 PUNTOS EN COORDENADAS
CILINDRICAS
Program Distancia_en_coordenadas_Cilindricas;
Uses
Forms,Dialogs,Sysutils;
var
r1,a1,h1,r2,a2,h2,x1,y1,z1,x2,y2,z2,distancia:double;
begin
r1:=strtofloat(inputbox('punto1','ingrese radial 1',''));
a1:=strtofloat(inputbox('punto1','ingrese azimutal 1',''));
h1:=strtofloat(inputbox('punto1','ingrese horitzontal 1',''));
r2:=strtofloat(inputbox('punto2','ingrese radial 2',''));
a2:=strtofloat(inputbox('punto2','ingrese azimutal 2',''));
h2:=strtofloat(inputbox('punto2','ingrese horitzontal 2',''));
x1:=r1*cos(a1/180);
y1:=r1*sin(a1/180);
z1:=h1;
x2:=r2*cos(a2/180);
y2:=r2*sin(a2/180);
z2:=h2;
distancia:=sqrt(sqr(x2-x1)+sqr(y2-y1)+sqr(z2-z1));
showmessage('la distancia entre 2 puntos en coordenadas cilindricas es: ' +floattostr(distancia));
end.
PROGRAMA 3
PROMEDIO DE 8 ESTUDIANTES CON 10 NOTAS
program Promedio_de_notas;
uses
forms,
dialogs,
sysutils;
var
n:string;
n1,n2,n3,n4,n5,n6,n7,n8,n9,n10:integer;
type testudiante=class
procedure iniciar(n:string;n1,n2,n3,n4,n5,n6,n7,n8,n9,n10:integer);
function media:real;
procedure mostrar;
private
nombre:string;
nota1,nota2,nota3,nota4,nota5,nota6,nota7,nota8,nota9,nota10:REAL;
end;
procedure testudiante.iniciar;
begin
nombre:=n;nota1:=n1;nota2:=n2;nota3:=n3;nota4:=n4;nota5:=n5;nota6:=n6;nota7:=n7;nota8:=n8
;nota9:=n9;nota10:=n10;
end;
function testudiante.media;
begin
media:=(nota1+nota2+nota3+nota4+nota5+nota6+nota7+nota8+nota9+nota10)/10;
end;
procedure testudiante.mostrar;
begin
showmessage(nombre+#13+#13+#13'Ha Obtenido de PROMEDIO'+#13'='+floattostr(media));
end;
var e1,e2,e3,e4,e5,e6,e7,e8:testudiante;
begin
e1:=testudiante.Create;
e2:=testudiante.Create;
e3:=testudiante.Create;
e4:=testudiante.Create;
e5:=testudiante.Create;
e6:=testudiante.Create;
e7:=testudiante.Create;
e8:=testudiante.Create;
e1.iniciar('Gilmar Alvis',100,100,100,100,100,100,100,100,100,100);e1.mostrar;
e2.iniciar('Edson Zabala',40,80,77,54,80,50,80,50,50,70);e2.mostrar;
e3.iniciar('Omar Dominguez',70,60,50,60,80,65,100,80,80,75);e3.mostrar;
e4.iniciar('Cristian Martinez',58,50,90,60,40,20,46,50,60,80);e4.mostrar;
PROGRAMA 4
MAYOR DE 8 NUMEROS
unit Unit1;
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;
Edit7: TEdit;
Edit8: TEdit;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Button2: TButton;
Edit9: TEdit;
Label10: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
PROGRAMA 5
3 USUARIOS Y 4 CONTRASEAS CON 60 SEGUNDOS Y 3
INTENTOS
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Buttons;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Label12: TLabel;
Timer1: TTimer;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
procedure BitBtn1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
else
if Form1.Tag<3 then
showmessage('CONTRASEA INCORRECTA INTENTE DE NUEVO');
if Form1.Tag>=3 then
begin
Timer1.Enabled:=false;
Label12.Caption:='';
MessageDlg('SE LE TERMINO LAS OPORTUNIDADES', mtwarning,[MbOK],1);
close
end
else
Form1.Tag:=Form1.Tag+1;
edit1.SelStart:=0;
edit1.SelLength:=length(edit1.text);
edit1.SetFocus;
end;
PROGRAMA 6
CONVERSION DE UNIDADES
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Button1: TButton;
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure Edit2KeyPress(Sender: TObject; var Key: Char);
procedure Edit3KeyPress(Sender: TObject; var Key: Char);
procedure Edit4KeyPress(Sender: TObject; var Key: Char);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
var
kgcm2,libpul2,kippie2,tonm2:double;
begin
case ord(key) of
13:begin
PROGRAMA 7
TANGENTE APROXIMADA
unit unit1;
interface
uses
windows, messages, sysutils, variants, classes, graphics, controls, forms,
dialogs, stdctrls;
type
tform1 = class(tform)
button1: tbutton;
edit1: tedit;
edit2: tedit;
edit3: tedit;
label1: tlabel;
label2: tlabel;
label3: tlabel;
label4: tlabel;
button2: tbutton;
procedure button1click(sender: tobject);
procedure button2click(sender: tobject);
private
{ private declarations }
public
{ public declarations }
end;
var
form1: tform1;
implementation
{$r *.dfm}
function coseno(ang:double):real;
var t,x,s,i:double;
begin
x:=(ang*3.141592654)/180;
t:=-(x*x)/2;
PROGRAMA 8
RAIZ APROXIMADA DE 11
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Edit1: TEdit;
GroupBox1: TGroupBox;
Label2: TLabel;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
const cota=1E-6;
var
Form1: TForm1;
implementation
{$R *.dfm}
PROGRAMA 9
GRAFICAR NOMBRE Y APELLIDO
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class(TForm)
procedure FormPaint(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormPaint(Sender: TObject);
begin
with canvas do
begin
pen.color:=clblue;
pen.Width:=3;
polyline([point(40,40),point(80,40),point(60,40),point(60,80),point(40,80),point(40,60)]); //dibuja
la letra J
polyline([point(100,40),point(100,80),point(120,80),point(120,40)]); //dibuja la letra U
polyline([point(140,80),point(140,40),point(160,40),point(160,60),point(140,60),point(160,60),poi
nt(160,80)]); //dibuja la letra A
polyline([point(180,80),point(180,40),point(200,80),point(200,40)]);//dibuja la letra N
polyline([point(280,40),point(260,40),point(260,80),point(280,80)]);//dibuja la letra C
polyline([point(300,80),point(300,40),point(320,40),point(320,60),point(300,60),point(320,80)]);//
dibuja la letra R
end;
PROGRAMA 10
GRAFICAR CUADRADOS Y RECTANGULOS DINAMICOS
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormActivate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
x,y,dx,dy:integer;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);