1
I’m studying the use of CASE in the Pascal language, but when I run it appears syntactic error ";" não esperado, in this algorithm:
Program Crianca_Esperanca ;
    var
    D: integer;
    valor: real;
Begin
    writeln('--------------------------------');
    writeln('        CRIANÇA ESPERANÇA       ');
    writeln('--------------------------------');
    writeln('    Muito obrigado por ajudar'  );
    writeln(' [1] para doar R$10 ');
    writeln(' [2] para doar R$25 ');
    writeln(' [3] para doar R$50 ');
  writeln(' [4] para doar outros valores ');
  writeln(' [5] para cancelar');
  read(D);
    case D of 
  1:valor:=10;
  2:valor:= 25;
  3:valor:=50;
  4: writeln('Qual valor da doação? R$');
  readln(valor);
  5:valor:=0;
  writeln('------------------------------');
  writeln('SUA DOAÇÃO FOI DE R$', valor);
  writeln('MUITO OBRIGADO!');
  writeln('------------------------------');
  end;
     readln;
and.
It has actually compiled, but still does not perform the desired activity, it is as if it ignores the other values(1,2,3,5) and only works on option 4.
– Glaucio Pontes