You are on page 1of 8

Tad TipoFoto Interface Type exportado foto; Procedure crear (var F:foto; nombre: string; cantidad:integer; color:char); Procedure

VerNombre ( F:foto; var nombre: string); Function verCantidad (F:foto): integer; Function verColor (F:foto): char; Procedure modificarCantidad (var F:foto; cantidad:integer); Procedure modificarColor (var F:foto; color:char); Procedure asignar (var F1:foto; F2:foto;); 1- Implemente el Tad TipoEtiquetador. Tad TipoEtiquetadorFoto 2- Informar cual es el nombre del Tad Interface TipoEtiquetador con ms fotos. Uses TipoFoto; 3- Convertir todas las fotos de cada Tad Type exportado etiquetador; TipoEtiquetador a color . Procedure crear (var E: etiquetador; nom:string); Procedure AgregarFoto ( var E:etiquetador; F:foto); Function Cantidad (E:etiquetador): integer; Procedure colorerar (varE:etiquetador); Fucntion ExisteFigurita (E:etiquetador; nombre:string):boolean; Procedure verNombre (E:etiquetador; var nom:string);

Program uno; Uses TipoEtiquetadorFoto; Type listaEtiquetadores = ^nodo; nodo = record elem: etiquetador; sig: listaEtiquetadores; end; Var l:listaEtiquetadores; max:string; Begin l:= nil; cargarLista (l); //ya est implementado maximo y convertir (l,max); End.

Procedure maximo y convertir (l:listaEtiquetadores,var max:string); Var valorMax:integer; Begin mientras (no se termine la lista de Etiquetadores) begin pregunto la cantidad de fotos del etiquetador actual (valorActual) comparo con el mximo (maximo); si valorActual > maximo entonces pregunto el nombre del etiquetador (max) actualizo maximo con valorActual coloreo las fotos del etiquetador actual avanzo al siguiente etiquetador end; End.

Procedure maximo y convertir (l:listaEtiquetadores,var max:string); Var valorActual:integer; maximo:integer; Begin maximo:= -1; while (l <> nil) do begin valorActual:= Cantidad (l^.elem); //Operacin del Tad TipoEtiquetador if (valorActual > maximo) then begin consultarNombre (l^.elem, max); //Operacin del Tad TipoEtiquetador maximo:= valorActual; end; colorear (l^.elem); //Operacin del Tad TipoEtiquetador l:= l^.sig; end; Cmo implemento el Tad End.
TipoEtiquetador?

Tad TipoEtiquetadorFoto Interface Uses TipoFoto; Type exportado etiquetador; Procedure crear (var E: etiquetador; nom:string); Procedure AgregarFoto ( var E:etiquetador; F:foto); Function Cantidad (E:etiquetador): integer; Procedure colorerar (varE:etiquetador); Fucntion ExisteFigurita (E:etiquetador; nombre:string):boolean; Implementation arbolFotos= ^nodo; nodo= record elem:foto; HI: arbolFotos; HD: arbolFotos; end; etiquetador = record nombre: string; cant:integer; fotos: arbolFotos; end;

Procedure crear (var E: etiquetador; nom:string); Begin e.fotos:= nil; e.cant:=0; e.nombre:= nom; End; Function Cantidad (E:etiquetador): integer; Begin Cantidad:= e.cant; End; Procedure colorerar (varE:etiquetador); Begin if (e.fotos <> nil) then begin colorear (e.fotos^.HI); modificarColor (e.fotos^.elem, S); colorear (e.fotos^.HD); end; End;

Procedure auxiliarColorear (a: arbolFotos); Begin if (a <> nil) then begin auxiliarColorear (a^.HI); modificarColor (a^.elem, S); auxiliarColorear (a^.HD); end; End; Procedure colorerar (varE:etiquetador); Begin if (e.fotos <> nil) then begin auxiliarColorear (e.fotos); end; End;

Procedure Agregar ( var a:arbolFotos; nom:string; F:foto); Var nomAux:string; Begin if (a = nil) then begin new (a); asignar (a ^.elem, F); a^.HD:= nil; a^.HI:= nil; end else consultarNombre (a^.elem, nomAux); if (nom <= nomAux) then agregar (a^.HI,nom,F) else agregar (a^.HD,nom,F); End; Procedure AgregarFoto ( var E:etiquetador; F:foto); Var nomFoto:string; Begin consultarNombre (F,nomFoto); agregar (E.fotos, nomFoto,F); End;

You might also like