raulcampeao Posted December 17, 2009 at 11:08 AM Report Share #301022 Posted December 17, 2009 at 11:08 AM 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. Link to comment Share on other sites More sharing options...
M6 Posted December 17, 2009 at 12:32 PM Report Share #301047 Posted December 17, 2009 at 12:32 PM 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." Link to comment Share on other sites More sharing options...
raulcampeao Posted January 14, 2010 at 06:40 PM Author Report Share #306116 Posted January 14, 2010 at 06:40 PM obrigado 😄 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now