SO! I need finish this task to create a program able to read 3 sides of the a triangle in Tedit and analyse the results and give some answers such as: the triangle is an isoceles, equilateral or scalene...and show a picture according to the answer. Also calculate the height of the triangle and the total area.

Please! anyone can give a clue!!

unit Utriangulo;
interface
uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  ExtCtrls, StdCtrls, jpeg;
type
  TForm1 = class(TForm)
    txtab: TEdit;
    txtac: TEdit;
    txtbc: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    lblbase: TLabel;
    lblaltura: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Button1: TButton;
    lbltipo: TLabel;
    Label9: TLabel;
    lblarea: TLabel;
    Label5: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure ler(Sender:Tobject);
    procedure txtabKeyPress(Sender: TObject; var Key: Char);
    procedure txtacKeyPress(Sender: TObject; var Key: Char);
    procedure txtbcKeyPress(Sender: TObject; var Key: Char);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
var
  Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var
   L1,L2,L3,soma_ab,altura,area,s:real;
   msg:String;
begin
L1:=strtofloat(txtab.text);
L2:=strtofloat(txtac.text);
L3:=strtofloat(txtbc.text);
 
//(( b - c ) < a < (b + c))
if   (L2-L3<L1) and (L1<L2+L3) then;
//if (L1+L3<L2) then
begin
//showmessage('Não é um Triângulo! Digite valores válidos!');
MSG := 'Dados Inválidos!!! ' + #13 + ' O Valor da Base Deve ser Digitado ' + #13 + 'No Campo "Lado AC" ';
Application.MessageBox(Pchar(MSG),'Atenção!',MB_OK + MB_ICONINFORMATION);
exit;
txtab.SetFocus;
end;
if (L1=L3) and (L3=L2) Then
begin
lbltipo.caption:='EQUILÁTERO';
equilatero.visible:=true;
isosceles.visible:=false;
escaleno.visible:=false;
end;
if (L1=L3) and (L1<>L2) then
begin
lbltipo.caption:='ISOSCELES';
equilatero.visible:=false;
isosceles.visible:=true;
escaleno.visible:=false;
end;
if (L1<>L3) and (L3<>L2)then
begin
lbltipo.caption:='ESCALENO';
equilatero.visible:=false;
isosceles.visible:=false;
escaleno.visible:=true;
end;
S:=(L1 + L2 + L3)/2;
area:=sqrt(S*((S-L1)*(S-L3)*(S-L2)));
lblarea.caption:=floattostr(area);
altura:= 2*(area/L2);
lblaltura.caption:=floattostr(altura);
//soma_ab:=sqr(L1)-sqr(L2/2);
//altura:=sqrt(soma_ab);
//lblaltura.caption:=floattostr(altura);
//area:=(L2*altura)/2;
//lblarea.caption:=floattostr(area);
lblbase.caption:=floattostr(L2);
end;
procedure TForm1.ler(Sender:Tobject);
VAR
L1,L2,L3:REAL;
begin
L1:=strtofloat(txtab.text);
L2:=strtofloat(txtac.text);
L3:=strtofloat(txtbc.text);
end;
 
procedure TForm1.txtabKeyPress(Sender: TObject; var Key: Char);
begin
If not(Key in ['0'..'9',',',#8]) then
begin
beep;
Key := #0;
ShowMessage('Digite um Dado válido!!!');
end;
end;
procedure TForm1.txtacKeyPress(Sender: TObject; var Key: Char);
begin
If not(Key in ['0'..'9',',',#8]) then
begin
beep;
Key := #0;
ShowMessage('Digite um Dado válido!!!');
end;
end;
procedure TForm1.txtbcKeyPress(Sender: TObject; var Key: Char);
begin
If not(Key in ['0'..'9',',',#8]) then
begin
beep;
Key := #0;
ShowMessage('Digite um Dado válido!!!');
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
end;
end.

SORRY!! Some parts are in portuguese...

Solved!!!
Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.