joaovasco Posted May 6, 2008 at 08:50 AM Report Share #183548 Posted May 6, 2008 at 08:50 AM Este programa tem como funcionalidade usar um registo e um array para armazenar as informações. O programa deve conter as seguintes opções: adicionar CD, listar CDs em stock, listar CDs por grupo ou artista e sair do programa. Os dados referentes aos CDs são: nome do CD, nome do artista/grupo, género de música, n.º de faixas, ano de edição e preço. Até agora fiz isto program exerc1; uses crt; type rec=record codigo:integer; nome_artista:string; genero:string; n_faixas:integer; ano_edicao:integer; preco:real; end; var aux:array[1..10] of rec; var i:integer; j:rec; cod,op,op2,alt,a,b:integer; codi:string; novo:integer; existe:boolean; Begin clrscr; Begin For i:=1 to 10 do Begin writeln('Insira o codigo do ',i,' cd'); readln(j.codigo); writeln('Insira o nome do ',i,' artista/banda musical'); readln(j.nome_artista); writeln('Insira o g‚nero do ',i,' album'); readln(j.genero); writeln('Insira o numero de faixa do ',i,' album'); readln(j.n_faixas); writeln('Insira o ano de edicao do ',i,' album'); readln(j.ano_edicao); writeln('Insira o preco do ',i,' album'); readln(j.preco); aux[i]:=j; end; clrscr; writeln('Menu'); writeln('1-Adicionar cd'); writeln('2-Listar cd em stock'); writeln('3-Listar cds por grupo/artista'); writeln('4-Sair do programa'); readln(op); if (op<=0) or (op>=5) then Begin clrscr; writeln('a sua opcao ‚ errada'); end; case op of 1:begin clrscr; writeln('Digite o codigo do novo cd'); end; 2:begin clrscr; writeln('Insira o codigo do cd'); readln(cod); existe:=false; for i:=1 to 10 do Begin j:=aux[i]; If cod=j.codigo then Begin existe:=true; end; end; if existe=false then Begin clrscr; writeln('opcao errada'); readln; end else for i:=1 to 10 do Begin j:=aux[i]; If cod=j.codigo then Begin writeln('Nome do artista/banda musical ‚:',j.nome_artista); writeln('O genero musical do artista ‚:',j.genero); writeln('O numero de faixas do album ‚:',j.n_faixas); writeln('O ano de edicao ‚:',j.ano_edicao); writeln('O preco do album ‚:',j.preco); readln; end; end; end; 3:begin clrscr; writeln('Digite o nome de uma banda ou artista'); readln(codi); existe:=false; for i:=1 to 10 do Begin j:=aux[i]; if codi=j.nome_artista then Begin existe:=true; end; end; if existe =true then begin for i:=1 to 10 do begin j:=aux[i]; if codi=j.nome_artista then begin clrscr; writeln(j.genero); writeln(j.n_faixas); writeln(j.ano_edicao); writeln(j.preco); readln; end; end; end else begin clrscr; writeln('ESSE NOME DE BANDA INVALIDO'); readln; end; end; 4:begin Exit; writeln('Fim de Programa'); readln; end; end; end; end. A questão é que não sei adicionar os cds. alguem sabe o codigo? obrigado 👍 Link to comment Share on other sites More sharing options...
joaovasco Posted May 6, 2008 at 09:31 AM Author Report Share #183558 Posted May 6, 2008 at 09:31 AM .... :s Link to comment Share on other sites More sharing options...
joaovasco Posted May 6, 2008 at 10:12 AM Author Report Share #183560 Posted May 6, 2008 at 10:12 AM ninguem sabe mesmo?? Link to comment Share on other sites More sharing options...
TheDark Posted May 6, 2008 at 02:17 PM Report Share #183593 Posted May 6, 2008 at 02:17 PM Já tinhas calma. Assim ninguém te responde. Pões aí código a rodos, sem sequer estar indentado, e fazes bumps à bruta, não dá vontade de responder. Qual é exactamente a dúvida que tens para inserir os dados? Desaparecido. Link to comment Share on other sites More sharing options...
joaovasco Posted May 7, 2008 at 07:59 AM Author Report Share #183732 Posted May 7, 2008 at 07:59 AM a duvida que tenho é que não sei o código para a opção 1 (Adicionar cds). e pedia a alguem (se fosse possivel) que me ajudem nisto.. :S (as opcoes do menu do programa são: 1-ADICIONAR CDS 2- LISTAR CDS POR STOCK -> JÁ FIZ 3- LISTAR CDS POR ARTISTA -> JÁ FIZ 4- SAIR DO PROGRAMA -> JÁ FIZ) 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