program tabelaTosca; uses crt; type pessoa = record codigo:integer; profissao:string; end; var n:integer; nome:string; procedure procura(x:integer); var tabela:array[1..10] of pessoa; i:integer; achado:boolean; begin achado:=false; tabela[1].codigo:=1000; tabela[1].profissao:='alfaiate'; tabela[2].codigo:=1050; tabela[2].profissao:='analista'; {FALTA COLOCAR O RESTO DA TABELA PORRA!} for i:=1 to 10 do begin if tabela[i].codigo=x then begin achado:=true; writeln('nome da profissao ',tabela[i].profissao); end; end; if achado=false then writeln('codigo invalido'); end; function procuraTambem(x:integer):string; var tabela:array[1..10] of pessoa; i:integer; achado:boolean; begin achado:=false; tabela[1].codigo:=1000; tabela[1].profissao:='alfaiate'; tabela[2].codigo:=1050; tabela[2].profissao:='analista'; {FALTA COLOCAR O RESTO DA TABELA!} for i:=1 to 10 do begin if tabela[i].codigo=x then begin procuraTambem:=tabela[i].profissao; achado:=true; end; end; if achado=false then procuraTambem:='erro'; end; begin writeln('digita um codigo ae XD:'); readln(n); procura(n); nome:=procuraTambem(n); if nome='erro' then begin writeln('errado XD') end else begin writeln('nome da profissao ', nome); end; readkey; clrscr; end.