Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //fpc 3.0.0
- program HelloWorld;
- Uses sysutils;
- const
- numero_alternativas = 5;
- numero_questoes = 10;
- nota_minima = 6;
- var
- resp_alunos: array of array of integer;
- nome_alunos: array of String;
- notas_alunos: array of integer;
- gabarito: array of integer;
- i, j: integer;
- numero_alunos: integer;
- begin
- //Ler o número de alunos
- numero_alunos := 10;
- //Definir tamanho dos arrays
- SetLength(resp_alunos, numero_alunos, numero_questoes);
- SetLength(nome_alunos, numero_alunos);
- SetLength(notas_alunos, numero_alunos);
- SetLength(gabarito, numero_questoes);
- //Ler a respostas das questões
- writeln('GABARITO >>>');
- for i:= 0 to numero_questoes - 1 do begin
- gabarito[i] := Random(numero_alternativas) + 1;
- writeln('Resposta da questão '+ IntToStr(i + 1) +': '+ IntToStr(gabarito[i]));
- end;
- //Ler o nome dos alunos e a resposta das questões
- writeln('NOME DOS ALUNOS E RESPOSTAS >>>>');
- for i:= 0 to numero_alunos - 1 do begin
- nome_alunos[i] := 'aluno_' + IntToStr(i + 1);
- notas_alunos[i] := 0;
- writeln('Nome do aluno: '+ nome_alunos[i]);
- for j:= 0 to numero_alunos - 1 do begin
- resp_alunos[i, j] := Random(numero_alternativas) + 1;
- writeln('Resposta da pergunta '+ IntToStr(j + 1) + ': '+ IntToStr(resp_alunos[i,j]));
- end;
- end;
- //Comparar respostas com o gabarito
- for i := 0 to numero_alunos - 1 do begin
- for j := 0 to numero_questoes - 1 do begin
- if(resp_alunos[i, j] = gabarito[j]) then begin
- notas_alunos[i] := notas_alunos[i] + 1;
- end;
- end;
- //writeln('O aluno '+ nome_alunos[i] +' obteve a nota ' + IntToStr(notas_alunos[i]));
- end;
- //Imprimir os alunos com nota maior ou igual que a minima
- writeln('ALUNOS APROVADOS >>>>');
- for i:=0 to numero_alunos - 1 do begin
- if(notas_alunos[i] >= nota_minima) then begin
- writeln('O aluno '+ nome_alunos[i] +' obteve a nota ' + IntToStr(notas_alunos[i]));
- end;
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement