Ir ao conteúdo
  • Cadastre-se

O que está errado com esse codigo?


Ir à solução Resolvido por New Nerd,

Posts recomendados

Bom, eu fiz esse código no Visualg e mandei ele passar para Pascal, porém da um erro FIM DE ARQUIVO não esperado. Estou usando o pascalzim 5.1.1.

program Family;uses Crt;varsurvey,ne,op:integer;dig,p1,pe1,p2,pe2,p3,pe3,p4,pe4,p5,pe5:string;beginwriteln;   writeln('digite 1 para começar ou esc para sair');   readln(op);   case (op) of   1 :    begin      ClrScr;      p1:= 'preto';      pe1:='1-XXXXXXXXX';      p2:= 'roxo';      pe2:='2-XXXXXXXXX';      p3:= 'laranja';      pe3:='3-XXXXXXXXX';      p4:= 'marrom';      pe4:='4-XXXXXXXXX';      p5:= 'amarelo';      pe5:='5-XXXXXXXXX';         writeln('               FAMILY FEUD');         writeln;         writeln('Qual a pior cor para se pintar uma casa?');         writeln('/======================================/');         writeln(pe1);         writeln(pe2);         writeln(pe3);         writeln(pe4);         writeln(pe5);         writeln('/======================================/');         write('Qual sua resposta: ');         readln(dig);         if(p1=dig) and (pe1 ='1-XXXXXXXXX') then begin            pe1 :=p1;         end else begin            if(p2=dig) and (pe2 ='2-XXXXXXXXX') then begin               pe2 :=p2;            end else begin               if(p3=dig) and (pe3 ='3-XXXXXXXXX') then begin                  pe3 :=p3;               end else begin                  if(p4=dig) and (pe4 ='4-XXXXXXXXX') then begin                     pe4 :=p4;                  end else begin                     if(p5=dig) and (pe5 ='5-XXXXXXXXX') then begin                        pe5:=p5;                     end else begin                        ne:=ne+1;                     end;                  end;               end;            end;         end;         if(ne=1) then begin            writeln('X');         end else begin            if(ne=2) then begin               writeln('XX');            end else begin               if(ne>=3) then begin                  writeln('XXX');                  writeln('OBRIGADO POR JOGAR FAMILY FEUD');                  writeln('ATÈ A PRÓXIMA VEZ');               end;            end;         end;         end;
Link para o comentário
Compartilhar em outros sites

  • Solução

Olá Rogério!

 

O negócio é o seguinte está faltando um end; e um end. no fim do código, coloquei abaixo o código corrigido.

program Family;uses Crt; varsurvey,ne,op:integer;dig,p1,pe1,p2,pe2,p3,pe3,p4,pe4,p5,pe5:string;beginwriteln;   writeln('digite 1 para começar ou esc para sair');   readln(op);   case (op) of   1 :    begin      ClrScr;      p1:= 'preto';      pe1:='1-XXXXXXXXX';      p2:= 'roxo';      pe2:='2-XXXXXXXXX';      p3:= 'laranja';      pe3:='3-XXXXXXXXX';      p4:= 'marrom';      pe4:='4-XXXXXXXXX';      p5:= 'amarelo';      pe5:='5-XXXXXXXXX';           writeln('               FAMILY FEUD');         writeln;         writeln('Qual a pior cor para se pintar uma casa?');         writeln('/======================================/');         writeln(pe1);         writeln(pe2);         writeln(pe3);         writeln(pe4);         writeln(pe5);         writeln('/======================================/');           write('Qual sua resposta: ');         readln(dig);         if(p1=dig) and (pe1 ='1-XXXXXXXXX') then begin            pe1 :=p1;         end else begin            if(p2=dig) and (pe2 ='2-XXXXXXXXX') then begin               pe2 :=p2;            end else begin               if(p3=dig) and (pe3 ='3-XXXXXXXXX') then begin                  pe3 :=p3;               end else begin                  if(p4=dig) and (pe4 ='4-XXXXXXXXX') then begin                     pe4 :=p4;                  end else begin                     if(p5=dig) and (pe5 ='5-XXXXXXXXX') then begin                        pe5:=p5;                     end else begin                        ne:=ne+1;                     end;                  end;               end;            end;         end;         if(ne=1) then begin            writeln('X');         end else begin            if(ne=2) then begin               writeln('XX');            end else begin               if(ne>=3) then begin                  writeln('XXX');                  writeln('OBRIGADO POR JOGAR FAMILY FEUD');                  writeln('ATÈ A PRÓXIMA VEZ');               end;            end;         end;       end;     end;  end.

Falou cara, boa sorte!

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...