profile
Опубликовано 5 лет назад по предмету Информатика от loveisolea

Даны следующие типы данных: 
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) и выводит на экран: 
фамилию и имя самого младшего человека

  1. Ответ
    Ответ дан Alexan2000
    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;
    begin
    for i:=1 to 50 do
    begin

    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 do
    if 
    JoungHuman> People[i].Birthday.day + People[i].Birthday.mounth*13 + People[i].Birthday.year * 32 * 13 then
    begin

    //
    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.









































Самые новые вопросы