Даны следующие типы данных: type date = record day : 1..31; mounth : 1..12; year : integer; end; person = record surnamename : string; birthday : date; end; listofpeople = array [1..50] of person; напишите программу, которая вводит с клавиатуры данные о n лицах(n< =50) и выводит на экран: фамилию и имя самого младшего человека
177
215
Ответы на вопрос:
Program pro1; type date = record day : 1..31; mounth : 1..12; year : integer; end; person = record surnamename : string; birthday : date; end; listofpeople = array [1..50] of person; var people: listofpeople; jounghuman: integer; i, jounghumanindex: byte; beginfor i: =1 to 50 dobegin write('human '+inttostr(i)+': ')write('input surname and name: ')readln(people[i].surnamename); write('input birthday date(day, mounth, year) : ')read(people[i].birthday.day, people[i].birthday.mounth, people[i].birthday.year); end; // jounghumanindex: =1; //jounghuman: =people[1].birthday.day + people[1].birthday.mounth*13 + people[1].birthday.year * 32 * 13; for i: =2 to 50 doif jounghuman> people[i].birthday.day + people[i].birthday.mounth*13 + people[i].birthday.year * 32 * 13 thenbegin // jounghumanindex: =i; // jounghuman: =people[i].birthday.day + people[i].birthday.mounth*13 + people[i].birthday.year * 32 * 13; end; writeln('most joung human: '+people[jounghumanindex] .surnamename); end.
1input "n=", n s = 0 for i = 1 to n s = s + i ^ 2 next i print 4 * s 2 10 минут - это 1/6 часа и суммировать дроби, в знаменателе которых число 6, означает накапливать погрешности представления нецелых чисел в эвм. поэтому расчеты лучше делать в минутах, а результат потом перевести в часы. получаем сумму s=60м+(60м+10)+(60м+20)++[60м+10*(n-1)] input "m,n=", m, n print 5 * n * (12 * m + n - 1) / 60 вот такие получаются короткие программы, если сначала думать, а потом писать.
Популярно: Информатика
-
lyubimova8404.08.2022 23:03
-
HelpmeAnna122.07.2021 08:33
-
ilyacher12311.11.2020 04:35
-
chronicempty05.07.2020 22:16
-
IiiPON4IKiiI07.10.2020 18:58
-
scravtz26.08.2021 04:49
-
катейка2210.05.2021 07:23
-
шрвлап23.01.2022 16:05
-
olyavlas2305.09.2020 15:00
-
Ellis203411.12.2020 05:45