marcus2vinicius

Eleicao Presidencial While - PASCAL

Aug 28th, 2011
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.38 KB | None | 0 0
  1. Program Pzim ;
  2. var
  3.  nul,branco,lula,dilma,serra,plinio: integer;
  4.  opcao,cont: integer;
  5.  res: boolean;
  6.  Begin
  7.   res:= true;
  8.   nul:=0;
  9.     While res do {pode ser tbm while (res=true) do}
  10.     Begin
  11.      cont:= cont + 1;
  12.      WriteLn('1 ----- Lula');
  13.      WriteLn('2 ----- Dilma');
  14.      WriteLn('3 ----- Serra');
  15.      WriteLn('4 ----- Plinio');
  16.      WriteLn('5 ------------ Nulo');
  17.      WriteLn('6 ------------ Branco');
  18.      WriteLn('0 ------------ Sair');
  19.      Write('Opcao: ');
  20.      readln(opcao);
  21.       if (opcao = 1) then
  22.        lula:= lula + 1
  23.       else if (opcao = 2) then
  24.        dilma:= dilma + 1
  25.       else if (opcao = 3) then
  26.        serra:= serra + 1
  27.       else if (opcao = 4) then
  28.        plinio:= plinio + 1
  29.       else if (opcao = 5) then
  30.        nul:=nul+1
  31.       else if (opcao = 6) then
  32.        branco:=branco + 1
  33.       else if (opcao = 0) then
  34.        Begin
  35.         res:= false;
  36.         cont := cont - 1;
  37.        end;
  38.      clrscr;
  39.     end;
  40.     Writeln('Lula   ',lula,' ',lula/cont*100:3:0,'%');
  41.     Writeln('Dilma  ',dilma,' ',dilma/cont*100:3:0,'%');
  42.     Writeln('Serra  ',serra,' ',serra/cont*100:3:0,'%');
  43.     Writeln('Plinio ',plinio,' ',plinio/cont*100:3:0,'%');
  44.     Writeln('   Nulo   ',nul,' ',nul/cont*100:3:0,'%');
  45.     Writeln('   Branco ',branco,' ',branco/cont*100:3:0,'%');
  46.     Writeln('               by Marcus Vinicius');  
  47.  End.
Advertisement
Add Comment
Please, Sign In to add comment