Documente Academic
Documente Profesional
Documente Cultură
CARACTERISTICAS PERSONALES
program CARACTERISTICAS_PERSONALES;
uses
forms,dialogs,sysutils;
begin
END.
PROGRAMA 2
DISTANCIA ENTRE DOS PUNTOS
Program Distancia_entre_dos_puntos_en_coordenadas_polares;
uses
Forms,
Dialogs,
Sysutils;
const
pi=3.141592654;
var
r1,a1,r2,a2,x1,x2,distancia:double;
begin
r1:=strtofloat(inputbox('punto1','ingrese distancia 1',''));
a1:=strtofloat(inputbox('punto1','ingrese angulo 1 en grados sexagesimales',''));
x1:=(2*pi*a1/360);
x2:=(2*pi*a2/360);
distancia:=sqrt(sqr(r1)+sqr(r2)-2*r1*r2*cos(x2-x1));
showmessage('la distancia entre 2 puntos en coordenadas polares es: '
+floattostr(distancia));
end.
PROGRAMA 3
MAYOR DE 8 NUMEROS
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Edit9: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end.
PROGRAMA 4
USUARIOS Y CONTRASEAS
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Timer1: TTimer;
Label8: TLabel;
procedure BitBtn1Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
IF(LOWERCASE(EDIT1.Text)='juan')AND(LOWERCASE(EDIT3.Text)='123')THEN
IF(LOWERCASE(EDIT2.Text)='carlos')AND(LOWERCASE(EDIT4.Text)='456')THEN
IF(LOWERCASE(EDIT5.Text)='7')THEN
IF(LOWERCASE(EDIT6.Text)='8')THEN
BEGIN
TIMER1.Enabled:=FALSE;
LABEL8.Caption:='';
SHOWMESSAGE('BIENBENIDO AL SISTEMA');
CLOSE
END
ELSE
BEGIN
SHOWMESSAGE('ERROR..!!! CONTRASEA INCORRECTA');
END;
end;
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;
Edit5: TEdit;
Label6: TLabel;
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);
procedure Edit5KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var
kg,lib,kip,ton,g:double;
begin
case ord(key) of
13:begin
if(sender=edit5)then
g:=strtofloat(edit5.text);
kg:=g*(1/1000);
lib:=g*(0.002205);
kip:=g*(2.205/1000000);
ton:=g*(1/1000000);
edit1.Text:=floattostr(kg);
edit2.text:=floattostr(lib);
edit3.text:=floattostr(kip);
edit4.text:=floattostr(ton);
end;
end;
end;
end.
PROGRAMA 6
RAIZ NOVENA APROXIMADA
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}
end;
end;
end.
PROGRAMA 7
INTEGRAL POR EL METODO DE SIMPSON
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label5: TLabel;
Edit4: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
FUNCTION f(x:real):real;
BEGIN
f:=1/sqrt(1+sqr(x))
END;
FUNCTION simpson(a,b:real;m:byte):real;
var
x,xl,xl1,xl2,xl0,h:real;
l,n:byte;
begin
n:=2*m;h:=(b-a)/a;
xl0:=f(a)+f(b);
xl1:=0;
xl2:=0;
for l:=1 to 2*m-1 do
begin
x:=a+l*h;
if l mod 2=0 then
xl2:=xl2+f(x)
end;
xl:=h*(xl0+2*xl2+4*xl1)/3;
simpson:=xl;
end;
procedure TForm1.Button1Click(Sender: TObject);
VAR
a,b,i:real;
m:byte;
begin
a:=strtofloat(edit1.text);
b:=strtofloat(edit2.Text);
m:=strtoint(edit3.Text);
i:=simpson(a,b,m);
edit4.Text:=floattostr(i);
end;
end.
PROGRAMA 8
FACTORIAL
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;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
end;
end.
PROGRAMA 9
SERIE DE FIBONACCI
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Edit2: TEdit;
ListBox1: TListBox;
procedure Edit1KeyPress(Sender: TObject; var Key: Char);
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
FUNCTION FIBONACCI (n:INTEGER):INTEGER;
BEGIN
IF (n=1) OR (n=2) THEN
FIBONACCI:=1
ELSE
FIBONACCI:=FIBONACCI(n-2) + FIBONACCI(n-1)
END;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
VAR
i,n,s,term:INTEGER;
begin
IF KEY=#13 THEN
BEGIN
n:=STRTOINT(EDIT1.TEXT);
FOR i:=1 TO n DO
BEGIN
term:=FIBONACCI(i);
s:=s+term;
LISTBOX1.Items.Add(INTTOSTR(FIBONACCI(i))+'^4'+'='+FLOATTOSTR(FIBONACCI(i)*FIBONACCI(i)*FI
BONACCI(i)*FIBONACCI(i)))
END;
BITBTN1.Enabled:=TRUE;
BITBTN1.SetFocus;
EDIT2.Text:=INTTOSTR(s)
END;
IF NOT (KEY IN['0'..'9',#8]) THEN KEY :=#0
end;
end.
PROGRAMA 10
GRAFICACION
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}
end;
end;
end.