Ir para conteúdo
Fórum Script Brasil
  • 0

logica_de_prgram._salario


wiliam.s.r

Pergunta

o programa a seguir feito em delphi deveria mostrar o resultado no final, porém quando executo ele faz as perguntas e fecha em seguida ,dando a mensagem de erro:

( [Hint] Project7_idades.dpr(48): Value assigned to 'p' never used)

[Hint] Project7_idades.dpr(18): Value assigned to 'salario_antigo' never used

[Hint] Project7_idades.dpr(9): Variable 'salario_novo' is declared but never used in 'Project7_idades'

alguém sabe o que há de errado?

var

p,idade,salario_antigo,salario_novo:re…

anos_trabalhados:integer;

begin

begin

writeln('idade');

readln(idade);

writeln('anos_trabalhados');

readln( anos_trabalhados);

writeln('salario');

readln(salario_antigo);

if (idade<=25)then

end;

begin

if (anos_trabalhados<=3) then

p:=0.05;

if (anos_trabalhados>=4) and(anos_trabalhados<=6)then

p:=0.1;

if(anos_trabalhados>=7)then

p:=0.15;

readln;

end;

if(idade>=26)and(idade<=35) then

begin

if(anos_trabalhados<=9)then

p:=0.20;

if(anos_trabalhados>=10)and(anos_traba… hen

p:=0.25;

if(anos_trabalhados>=15)then

p:=0.30;

readln;

end;

begin

if(idade>50)then

if(anos_trabalhados>10)then

p:=0.30;

if(anos_trabalhados>=11)and(anos_traba… hen

p:=0.40;

if(anos_trabalhados>=21)and(anos_traba… hen

p:=0.50;

if(anos_trabalhados>=31)and(anos_traba… hen

p:=0.60;

if(anos_trabalhados>40)then

p:=0.70;

end;

readln;

end.

Link para o comentário
Compartilhar em outros sites

1 resposta a esta questão

Posts Recomendados

  • 0
o programa a seguir feito em delphi deveria mostrar o resultado no final, porém quando executo ele faz as perguntas e fecha em seguida ,dando a mensagem de erro:

( [Hint] Project7_idades.dpr(48): Value assigned to 'p' never used)

[Hint] Project7_idades.dpr(18): Value assigned to 'salario_antigo' never used

[Hint] Project7_idades.dpr(9): Variable 'salario_novo' is declared but never used in 'Project7_idades'

alguém sabe o que há de errado?

var

p,idade,salario_antigo,salario_novo:re…

anos_trabalhados:integer;

begin

begin

writeln('idade');

readln(idade);

writeln('anos_trabalhados');

readln( anos_trabalhados);

writeln('salario');

readln(salario_antigo);

if (idade<=25)then

end;

begin

if (anos_trabalhados<=3) then

p:=0.05;

if (anos_trabalhados>=4) and(anos_trabalhados<=6)then

p:=0.1;

if(anos_trabalhados>=7)then

p:=0.15;

readln;

end;

if(idade>=26)and(idade<=35) then

begin

if(anos_trabalhados<=9)then

p:=0.20;

if(anos_trabalhados>=10)and(anos_traba… hen

p:=0.25;

if(anos_trabalhados>=15)then

p:=0.30;

readln;

end;

begin

if(idade>50)then

if(anos_trabalhados>10)then

p:=0.30;

if(anos_trabalhados>=11)and(anos_traba… hen

p:=0.40;

if(anos_trabalhados>=21)and(anos_traba… hen

p:=0.50;

if(anos_trabalhados>=31)and(anos_traba… hen

p:=0.60;

if(anos_trabalhados>40)then

p:=0.70;

end;

readln;

end.

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Já que niguem soube a resposta corri atrás e eu mesmo vou responder, se for útil pra alguém!!!

esta um pouco diferente mas no final dá no mesmo.

var

p1,salario_antigo,salario_novo:real;

idade, anos_trabalhados:integer;

begin

writeln('idade');

readln(idade);

writeln('anos_trabalhados');

readln( anos_trabalhados);

writeln('salario');

readln(salario_antigo);

begin

case idade of

0..25:

begin

case anos_trabalhados of

0..3: p1:=0.05;

4..6: p1:=0.10;

else

p1:=0.15;

end;

end;

26..49:

begin

case anos_trabalhados of

0..9: p1:=0.20;

10..15: p1:=0.25;

else

p1:=0.30;

end;

end;

else

begin

case anos_trabalhados of

0..10: p1:=0.30;

11..20: p1:=0.40;

21..30: p1:=0.50;

31..40: p1:=0.60

else

p1:=0.70;

end;

end;

end;

end;

begin

salario_novo:=(salario_antigo*p1)+salario_antigo;

end;

writeln ('o salario atual e:',salario_novo:7:2);

readln;

end.

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,9k
×
×
  • Criar Novo...