Program raf105;
type Info = record
family: string;
year: integer;
Score: record
exam1: byte;
exam2: byte;
exam3: byte;
end;
const
n = 3; // Количество студентов
var
Students: array[1..n] of Info;
i, goodStud, badStud, students1989Count, students1989ScoreSum: integer;
midScore1989: real;
begin
writeln('Введите информацию о ',n,' студентах');
for i:=1 to n do
writeln(' Студент ',i);
write('Фамилия: ');
readln(Students[i].family);
write('Год рождения: ');
readln(Students[i].year);
writeln('Введите информацию о его оценках (от 1 до 5)');
write('Оценка за 1 экзамен: ');
readln(Students[i].Score.exam1);
write('Оценка за 2 экзамен: ');
readln(Students[i].Score.exam2);
write('Оценка за 3 экзамен: ');
readln(Students[i].Score.exam3);
if Students[i].year <= 1989 then
students1989Count:= students1989Count + 3;
students1989ScoreSum:= students1989ScoreSum + Students[i].Score.exam1 + Students[i].Score.exam2 + Students[i].Score.exam3;
if (Students[i].Score.exam1 = 5) and (Students[i].Score.exam2 = 5) and (Students[i].Score.exam3 = 5) then
inc(goodStud);
if (Students[i].Score.exam1 <= 2) or (Students[i].Score.exam2 <= 2) or (Students[i].Score.exam3 <= 2) then
inc(badStud);
midScore1989:= students1989ScoreSum / students1989Count;
writeln;
writeln('Средний балл студентов 1989 года рождения и старше: ',midScore1989:3:1);
writeln('Количество отличников: ',goodStud);
writeln('Количество задолжников: ',badStud);
end.
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Program raf105;
type Info = record
family: string;
year: integer;
Score: record
exam1: byte;
exam2: byte;
exam3: byte;
end;
end;
const
n = 3; // Количество студентов
var
Students: array[1..n] of Info;
i, goodStud, badStud, students1989Count, students1989ScoreSum: integer;
midScore1989: real;
begin
writeln('Введите информацию о ',n,' студентах');
for i:=1 to n do
begin
writeln(' Студент ',i);
write('Фамилия: ');
readln(Students[i].family);
write('Год рождения: ');
readln(Students[i].year);
writeln('Введите информацию о его оценках (от 1 до 5)');
write('Оценка за 1 экзамен: ');
readln(Students[i].Score.exam1);
write('Оценка за 2 экзамен: ');
readln(Students[i].Score.exam2);
write('Оценка за 3 экзамен: ');
readln(Students[i].Score.exam3);
if Students[i].year <= 1989 then
begin
students1989Count:= students1989Count + 3;
students1989ScoreSum:= students1989ScoreSum + Students[i].Score.exam1 + Students[i].Score.exam2 + Students[i].Score.exam3;
end;
if (Students[i].Score.exam1 = 5) and (Students[i].Score.exam2 = 5) and (Students[i].Score.exam3 = 5) then
inc(goodStud);
if (Students[i].Score.exam1 <= 2) or (Students[i].Score.exam2 <= 2) or (Students[i].Score.exam3 <= 2) then
inc(badStud);
end;
midScore1989:= students1989ScoreSum / students1989Count;
writeln;
writeln('Средний балл студентов 1989 года рождения и старше: ',midScore1989:3:1);
writeln('Количество отличников: ',goodStud);
writeln('Количество задолжников: ',badStud);
end.
PascalABC