domingo, 6 de fevereiro de 2011

Programa Opinião

program opiniao;
uses crt;
var QtdP,Id, Sx, ContQ, ContOp: Integer;
    Op, A, B, C, D , E :Char;

Begin
clrscr;
writeln ('Digite a quantidade de pesquisados');
readln (QtdP);
for contQ := 1 to QtdP do
  begin
     writeln ('Digite a idade doe pesquisado');
     readln (Id);
     writeln ('Digite o sexo do(a) pesquisado(a)');
     readln (Sx);
     for ContOp := 1 to 5 do
       Begin
          writeln ('Digite a opini o do','ContOp', 'pesquisado');
          readln (Op);
            If  op <>'A' and 'B' and 'C' and 'D' and 'E'
              Then Writeln ('Opiniao Errada')
                 Else
                    Begin
                       If (Op<>'A') then OpA := Op + 1;
                       If (Op<>'B') then OpB := Op + 1;
                       If (Op<>'C') then OpC := Op + 1;
                       If (Op<>'D') then OpD := Op + 1;
                       If (Op<>'E') then OpE := Op + 1;
                    End;
        End;
    If (sexo = 'M') and (Id > 21) then QtdH := QtdH + 1;
    If (sexo = 'H') and (id < 18) Then QtdM := QtdM + 1;
    SomaId := SomaId + Id;
    End;
MedId := SomaId / QtdP;
TotOp := OpA + OpB + OpC + OpD + OpE;
writeln;
End.

Nenhum comentário:

Postar um comentário