xneox
12-11-2012, 18:58:46
hola a todos, tengo un ejercicio en la facultad el cual es hacer un programa que grafique las funciones aqui pongo una que dio el docente las demas funciones no se como hacerlas me ayudan porfavor
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Label4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
cx,cy:integer;{ Public declarations }
x,y :integer;
procedure Dibujapunto(x,y:real);
end;
var
Form1: TForm1;
implementation
procedure TForm1.Button2Click(Sender: TObject);
begin
dibujapunto(3,4);
end;
procedure TForm1.Button3Click(Sender: TObject);
var a,b:real;
begin
a:= -3;
b:= +3;
x:= trunc(a);
while x<b do begin
y:= x;
Dibujapunto(x,y);
x:=x+1;
end;
end;
procedure Tform1.Dibujapunto(x: Real; y: Real);
var rx, ry : integer;
begin
rx:= cx+(trunc(x)*10);
ry:= cy-(trunc(y)*10);
canvas.Pixels[rx,ry]:= clred;
end;
procedure TForm1.Label4Click(Sender: TObject);
begin
end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
cx:= strtoint(edit1.Text) ;
cy:= strtoint(edit2.Text) ;
canvas.moveto(cx,0);
canvas.LineTo(cx,1000);
canvas.MoveTo(0,cy);
canvas.LineTo(1000,cy);
end;
end.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
Label1: TLabel;
Label2: TLabel;
Button2: TButton;
Button3: TButton;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Label4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
{ Private declarations }
public
cx,cy:integer;{ Public declarations }
x,y :integer;
procedure Dibujapunto(x,y:real);
end;
var
Form1: TForm1;
implementation
procedure TForm1.Button2Click(Sender: TObject);
begin
dibujapunto(3,4);
end;
procedure TForm1.Button3Click(Sender: TObject);
var a,b:real;
begin
a:= -3;
b:= +3;
x:= trunc(a);
while x<b do begin
y:= x;
Dibujapunto(x,y);
x:=x+1;
end;
end;
procedure Tform1.Dibujapunto(x: Real; y: Real);
var rx, ry : integer;
begin
rx:= cx+(trunc(x)*10);
ry:= cy-(trunc(y)*10);
canvas.Pixels[rx,ry]:= clred;
end;
procedure TForm1.Label4Click(Sender: TObject);
begin
end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
cx:= strtoint(edit1.Text) ;
cy:= strtoint(edit2.Text) ;
canvas.moveto(cx,0);
canvas.LineTo(cx,1000);
canvas.MoveTo(0,cy);
canvas.LineTo(1000,cy);
end;
end.