0% found this document useful (0 votes)
22 views

Programa 1 Caracteristicas Personales

The document contains 8 programs written in Pascal/Delphi. Program 1 introduces a person with their name, age, birthplace, sign, school, major, hobbies, favorite music and sport. Program 2 calculates the distance between two points in polar coordinates. Program 3 finds the largest of 8 numbers input by the user.

Uploaded by

John Fisher Slim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views

Programa 1 Caracteristicas Personales

The document contains 8 programs written in Pascal/Delphi. Program 1 introduces a person with their name, age, birthplace, sign, school, major, hobbies, favorite music and sport. Program 2 calculates the distance between two points in polar coordinates. Program 3 finds the largest of 8 numbers input by the user.

Uploaded by

John Fisher Slim
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

PROGRAMA 1

CARACTERISTICAS PERSONALES
program CARACTERISTICAS_PERSONALES;
uses
forms,dialogs,sysutils;
begin

showmessage('HOLA MI NOMBRE ES JUAN CARLOS');


showmessage('TENGO 21 AOS');
showmessage('NACI EN POTOSI-BOLIVIA');
showmessage('DE SIGNO TAURO');
showmessage('VOY A LA UMSS');
showmessage('ESTOY EN LA FACULTAD DE CIENCIAS Y TECNOLOGIA');
showmessage('ESTUDIO LA CARRERA DE INGENIERIA CIVIL');
showmessage('ME GUSTA ESCUCHAR MUSICA EN MIS TIEMPOS LIBRES');
showmessage('ESCUCHO MUSICA ROCK');
showmessage('MI DEPORTE FAVORITO ES EL BASKET');
showmessage('TAMBIEN ME GUSTA DIBUJAR');
showmessage('ME APASIONA LA ASTRONOMIA');
showmessage('SOY UNA PERSONA TRANQUILA');
showmessage('ME GUSTA COMPARTIR CON LOS AMIGOS');
showmessage('MI COMIDA PREFERIDA ES EL PIQUE');
showmessage('ME GUSTA EL COLOR AZUL');

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',''));

r2:=strtofloat(inputbox('punto2','ingrese distancia 2',''));


a2:=strtofloat(inputbox('punto2','ingrese angulo 2 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}

procedure TForm1.Button1Click(Sender: TObject);


VAR
A,B,C,D,E,F,G,H,MAYOR:DOUBLE;
begin
A:=STRTOFLOAT(EDIT1.Text);
B:=STRTOFLOAT(EDIT2.Text);
C:=STRTOFLOAT(EDIT3.Text);
D:=STRTOFLOAT(EDIT4.Text);
E:=STRTOFLOAT(EDIT5.Text);
F:=STRTOFLOAT(EDIT6.Text);
G:=STRTOFLOAT(EDIT7.Text);
H:=STRTOFLOAT(EDIT8.Text);
MAYOR:=A;
IF(B>MAYOR)THEN
BEGIN
MAYOR:=B;
END;
IF(C>MAYOR)THEN
BEGIN
MAYOR:=C;
END;
IF(D>MAYOR)THEN
BEGIN
MAYOR:=D;
END;
IF(E>MAYOR)THEN
BEGIN
MAYOR:=E;
END;
IF(F>MAYOR)THEN
BEGIN
MAYOR:=F;
END;
IF(G>MAYOR)THEN
BEGIN
MAYOR:=G;
END;
IF(H>MAYOR)THEN
BEGIN
MAYOR:=H;
END;
EDIT9.TEXT:=FLOATTOSTR(MAYOR);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
CLOSE
end;

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;

procedure TForm1.Timer1Timer(Sender: TObject);


begin
LABEL8.Caption:='LE RESTAN'+INTTOSTR(TIMER1.TAG)+'SEGUNDOS';
TIMER1.Tag:=TIMER1.TAG-1;
IF(TIMER1.TAG=0)THEN
BEGIN
TIMER1.Enabled:=FALSE;
LABEL8.Caption:='';
SHOWMESSAGE('SE LE AGOTO EL TIEMPO, INTENTELO DESPUES');
CLOSE
END;
end;
end.
PROGRAMA 5
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;
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}

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


var
kg,lib,kip,ton,g:double;
begin
case ord(key) of
13:begin
if(sender=edit1)then
kg:=strtofloat(edit1.text);
lib:=kg*2.205;
kip:=kg*(2.205/1000);
ton:=kg*(1/1000);
g:=kg*1000;
edit2.Text:=floattostr(lib);
edit3.text:=floattostr(kip);
edit4.text:=floattostr(ton);
edit5.text:=floattostr(g);
end;
end;
end;

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


var
kg,lib,kip,ton,g:double;
begin
case ord(key) of
13:begin
if(sender=edit2)then
lib:=strtofloat(edit2.text);
kg:=lib*(1/2.205);
kip:=lib*(1/1000);
ton:=lib*(1/(2.205*1000));
g:=lib*(1/0.002205);
edit1.Text:=floattostr(kg);
edit3.text:=floattostr(kip);
edit4.text:=floattostr(ton);
edit5.text:=floattostr(g);
end;
end;
end;
procedure TForm1.Edit3KeyPress(Sender: TObject; var Key: Char);
var
kg,lib,kip,ton,g:double;
begin
case ord(key) of
13:begin
if(sender=edit3)then
kip:=strtofloat(edit3.text);
kg:=kip*(1000/2.205);
lib:=kip*1000;
ton:=kip*(1/2.205);
g:=kip*(1000000/2.205);
edit1.Text:=floattostr(kg);
edit2.text:=floattostr(lib);
edit4.text:=floattostr(ton);
edit5.text:=floattostr(g);
end;
end;
end;
procedure TForm1.Edit4KeyPress(Sender: TObject; var Key: Char);
var
kg,lib,kip,ton,g:double;
begin
case ord(key) of
13:begin
if(sender=edit4)then
ton:=strtofloat(edit4.text);
kg:=ton*1000;
lib:=ton*(2.205*1000);
kip:=ton*2.205;
g:=ton*(1000000);
edit1.Text:=floattostr(kg);
edit2.text:=floattostr(lib);
edit3.text:=floattostr(kip);
edit5.text:=floattostr(g);
end;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
close
end;
procedure TForm1.Edit5KeyPress(Sender: TObject; var Key: Char);

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}

procedure TForm1.Button1Click(Sender: TObject);


begin
CLOSE
end;

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


var
ant,dif,x,r:real;
begin
if(key=#13)then
begin
x:=strtofloat(edit1.text);
r:=x/9;
repeat
ant:=r;
r:=(ant+x/(ant*ant*ant*ant*ant*ant*ant*ant))/9;
dif:=abs(x-(r*r*r*r*r*r*r*r*r));
until (dif<1E-6);
label2.caption:='r= '+floattostr(r);

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;

procedure TForm1.Button2Click(Sender: TObject);


begin
close
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}

procedure TForm1.Button1Click(Sender: TObject);


var
n,co,re:double;
begin
n:=strtofloat(edit1.Text);
co:=1;
re:=1;
while(co<=n)do
begin
re:=re*co;
co:=co+1;
end;
edit2.Text:=floattostr(re)

end;

procedure TForm1.Button2Click(Sender: TObject);


begin
close
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;

procedure TForm1.BitBtn1Click(Sender: TObject);


begin
EDIT1.Clear;
EDIT1.SetFocus;
EDIT2.Clear;
LISTBOX1.Clear;
BITBTN1.Enabled:=FALSE;
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}

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),poin
t(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(360,40),point(340,40),point(340,80),point(360,80)]);//dibuja la letra C
polyline([point(420,80),point(420,40),point(440,40),point(440,60),point(420,60)]);
polyline([point(440,80),point(440,60)]);//dibuja la letra A mas la anterior
end;
with canvas do
begin
pen.Color:=clgreen; //color de trazo
pen.Width:=3; //grosor de trazo
brush.color:=clred; //color de fondo
brush.style:=bscross; //estilo de fondo
ellipse(40,120,80,160);
ellipse(100,120,140,160);
ellipse(160,120,200,160);
ellipse(220,120,260,160);
ellipse(280,120,320,160);
ellipse(340,120,380,160);

end;
end;
end.

You might also like