terça-feira, 30 de setembro de 2014

Exercicio_classe_repeat_until "Corrida Carro"





program Exercicio_classe_repeat_until;
     uses crt;
var
  batmovel : integer;
  mach5 : integer;
  herbie : integer;
  christine : integer;
  turnos : integer;

begin
  randomize();
  writeln('Turnos   batmovel   marchs   herbie   christine');
    REPEAT
          turnos := turnos + 1;
          batmovel := batmovel + (random(100) + 1);
          mach5:= mach5 + (random(100) + 1);
          herbie := herbie + (random(100) + 1);
          christine := christine + (random(100) + 1);
          writeln(turnos:4, '     ',batmovel:4,'       ',mach5:4,'    ',herbie:4, '      ',christine:4,'    ');

    until (batmovel > 1000)or(mach5 > 1000) or (herbie > 1000)or(christine > 1000) ;
          if (batmovel > mach5) and (batmovel > herbie) and (batmovel > christine) then
             writeln('Batmovel ganhou');
          if (mach5 > batmovel) and (mach5 > herbie) and (mach5 > christine) then
             writeln('mach5 ganhou');
          if (herbie > batmovel) and (herbie > mach5) and (herbie > christine) then
             writeln('herbie ganhou');
          if (christine > batmovel) and (christine > herbie) and (christine > mach5) then
             writeln('christine ganhou');
    readkey;
end.             

Nenhum comentário:

Postar um comentário

Pascal - Lazarus