TrabalhosGratuitos.com - Trabalhos, Monografias, Artigos, Exames, Resumos de livros, Dissertações
Pesquisar

Estrutura De Dados

Por:   •  25/10/2015  •  Trabalho acadêmico  •  1.520 Palavras (7 Páginas)  •  140 Visualizações

Página 1 de 7
  1. [pic 1]
  2. SISTEMAS DE INFORMAÇÃO
  3.  
  4.  

  1. ESTRUTURA DE DADOS

SALVADOR-BA.

2007

  1. [pic 2]

  1. SISTEMAS DE INFORMAÇÃO
  2.  
  3.  
  4.  

  1. POLÍGONO

Trabalho apresentado como requisito parcial para avaliação da disciplina Estrutura de Dados do curso de Sistemas de Informação do Centro Universitário - Faculdade Integrada da Bahia de Salvador – Ba, sob a orientação do professor Marcondes Dourado.

SALVADOR-BA.

2007

Program TrabAVII;

uses CRT,ListOrd, Graph;

var L  : LstOrd;

    X  : Poligono;

    OP : Char;

    Gd,

    Gm: Integer;

    res:String;

Begin

  InitGraph(Gd, Gm, 'e:\luciano\tp\bgi');  

  if GraphResult <> grOk then

      Halt(1);

  Create(L);

  i:=0;

  Repeat

    SetViewPort(0,0,639,479,true);

    Rectangle(220,5,637,478);

    SetViewPort(0,0,219,479,true);

    ClearViewPort;

    OutTextXY(00,10,'Opcoes do Poligono');

    OutTextXY(00,40,'1 - Criar Poligono');

    OutTextXY(00,60,'2 - Incluir Coordenada');

    OutTextXY(00,80,'3 - Excluir Coordenada');

    OutTextXY(00,100,'4 - Destruir Poligono');

    OutTextXY(00,120,'5 - Calc. Perimetro do Poligono');

    OutTextXY(00,140,'9 - Fim');

    OutTextXY(00,180,'Escolha sua Op‡ao: ');

    Op:=ReadKey;

    Case op of

      '1' : begin

            Create(L);

            OutTextXY(00,200,'Digite a coordenada X1: ');

            GotoXY(5,18);Readln(X.Col);

            OutTextXY(00,210,'Digite a coordenada Y1: ');

            GotoXY(5,19);Readln(X.Lin);

            i:=i+1;

            x.ID:=i;

            Ins(L,X);

            OutTextXY(00,220,'Digite a coordenada X2: ');

            GotoXY(5,20);Readln(X.Col);

            OutTextXY(00,230,'Digite a coordenada Y2: ');

            GotoXY(5,21);Readln(X.Lin);

            i:=i+1;

            x.ID:=i;

            Ins(L,X);

            OutTextXY(00,240,'Digite a coordenada X3: ');

            GotoXY(5,22);Readln(X.Col);

            OutTextXY(00,250,'Digite a coordenada Y3: ');

            GotoXY(5,23);Readln(X.Lin);

            i:=i+1;

            x.ID:=i;

            Ins(L,X);

            Show(L);

          end;

      '2' : begin

           OutTextXY(00,200,'Digite a coordenada X1: ');

           GotoXY(5,15);Readln(X.Col);

           OutTextXY(00,210,'Digite a coordenada Y1: ');

           GotoXY(5,16);Readln(X.Lin);

           i:=i+1;

           x.ID:=i;

           Ins(L,X);

           Show(l)

           end;

      '3' : begin

           OutTextXY(10,200,'Digite o nr. da coordenada a excluir: ');

           GotoXY(5,15);Readln(X.ID);

           Rem(l,X);

           Show(l);

          end;

      '4' : begin

            Create(l);

            SetViewPort(220,0,639,479,True);

            ClearViewPort;

          end;

      '5' : begin

              Str(PERIMETRO(L),Res);

              OutTextXY(00,200,'O perimetro do poligono e: '+Res);

              OutTextXY(00,230,'Tecle algo... ');

              readkey;

            End;

    end;

  until OP = '9';

end.

Unit ListOrd;

interface

Uses Graph;

Type Poligono = Record

         Col   : Integer;

         Lin   : Integer;

         ID    : Integer;

     End;

     LstOrd  = ^Nodo;

     Nodo    = Record

       obj   : Poligono;

       prox : LstOrd;

     end;

Var  L  : LstOrd;

     t1,t2:String;

     I,CC,LL:Integer;

Procedure Create(var L: LstOrd);

Function  Null(var L: LstOrd): Boolean;

Procedure Ins(var L:LstOrd; X:Poligono);

Function PERIMETRO(var L:LstOrd):Integer;

Function  Rem(var L:LstOrd; X:Poligono) : Boolean;

Procedure Show(L:LstOrd);

implementation

Procedure Create(var L: LstOrd);

begin

  L := nil;

  I:=0;

end;

Function Null(var L: LstOrd): Boolean;

begin

  null := ( L = nil )

end;

Procedure Ins(var L:LstOrd; X:Poligono);

Var N, P : LstOrd;

Begin

  New(N);

  N^.obj.ID   := X.ID;

  N^.obj.Col  := X.Col;

  N^.obj.Lin   := X.Lin;

  if (Null(L)) or (X.ID < L^.obj.ID) then

  begin

    N^.prox := L;

    L       := N;

  end

  else

  begin

    P := L;

...

Baixar como (para membros premium)  txt (6.3 Kb)   pdf (122.7 Kb)   docx (410 Kb)  
Continuar por mais 6 páginas »
Disponível apenas no TrabalhosGratuitos.com