Jump to content
raulcampeao

tratamento de ficheiros

Recommended Posts

raulcampeao

o algoritmo a seguir esta em estrutura de dados dinamicas e gostaria que alguem me ajudasse a passalo para Tratamento de ficheiros .

obrigado. :dontgetit:

Program muscs;

uses crt;

const max =5;

type

musicas=record

nom_music:string[65];

duracao:integer;

interprete:string[50];

nom_pedint:string[65];

localidade:string[50];

dedicatoria:string[250];

end;

var

i,y,p:integer;

music:array[1..5] of musicas;

   

procedure inserir;

begin

clrscr

y:integer;

writeln('**************************************************************************************************************************************');

writeln('********************************* insira o numero de clientes que pretende inserir ***************************************************');

writeln;

read(y);

writeln;

for i :=1 to y do

  Begin

  write('**insira o nome da musica**',i,':');

  read(music.nom_music);

  write('**insira a duração da musica**',i,':');

  read(music.duracao);

  write('**insira o interprete**',i,':');

  read(music.interprete);

  write('**insira o nome d0 pedinte**',i,':');

  read(music.nom_pedint);

  write('**insira a localidade**',i,':');

  read(music.localidade);

  write('**insira a dedicatoria**',i,':');

  read;

  read;

  end;

end;

    procedure sair;

    begin

    clrscr;

    writeln;

    writeln('********************************************************************************************************************************');

    writeln;

    writeln(' **fim do programa** ');

    writeln('********************************************************************************************************************************');

    writeln;

    end;

procedure listar;

begin

clcscr;

writeln;

writlen('*********************************************************************************************************************************');

for i := 1 to y do

  begin

  write;

  write('* nome da musica *',i, music.nom_music);

  write('* duracao *',i, music.duracao);

  write('* interprete *',i, music.interprete);

  write('* nome d0 pedinte *',i, music.nom_pedinte);

  write('* localidade *',i, music.localidade);

  write('* dedicatoria *',i, music.dedicatoria);

  write;

  end;

end;

      begin

    clrscr;

    repeat;

    clrscr;

    write('radio');

    write('menu');

    write('1 inserir');

    write('2 listar');

    write('3 sair');

    write ('insira a opção que deseja');

    read (p);

    if p <=3 then

    case p of

    1:inserir;

    2:listar;

    3:sair;

    else

    writeln('opção invalida');

      end;

        readln;

        readln;

end.

Share this post


Link to post
Share on other sites
M6

Se bem percebi queres guardar isso para um ficheiro?

Podes fazê-lo criando um ficheiro com esse tipo de dados e guardando lá essa informação.

Vê na documentação do Pascal e procura exemplos de file, assign, write e close.


10 REM Generation 48K!
20 INPUT "URL:", A$
30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50
40 PRINT "404 Not Found"
50 PRINT "./M6 @ Portugal a Programar."

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.