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;
Const N = 3; M = 4; Type Mass = array[1..N,1..M] of integer; ///Функция вычисления среднего арифметического элементов массива Function Sr(A:Mass):real; Var i,j:integer; Begin result:=0; For i:= 1 to N do For j:= 1 to M do result:=result+A[i,j]; result:=result/(M*N); End;
Var A:Mass; B:array[1..N,1..M-1] of integer; i,j,jMax,k:integer; S,MaxS:real; Begin Randomize; WriteLn('Исходная матрица:'); For i:= 1 to N do Begin For j:= 1 to M do Begin A[i,j]:=random(21)-10; Write(A[i,j]:3,' ') End; WriteLn End; WriteLn('Среднее арифметическое её элементов: ',Sr(A)); WriteLn; MaxS:=0; jMax:=1; For i:= 1 to N do MaxS:=MaxS+A[i,1]; For j:= 2 to M do Begin S:=0; For i:= 1 to N do S:=S+A[i,j]; if S > MaxS then Begin jMax:=j; MaxS:=S; End; End; k:=0; For j:= 1 to M do if jMax <> j then Begin k:=k+1; For i:= 1 to N do B[i,k]:=A[i,j]; End; WriteLn('Новая матрица:'); For i:= 1 to N do Begin For j:= 1 to M-1 do Write(B[i,j]:3,' '); WriteLn End; End.
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.
N = 3;
M = 4;
Type
Mass = array[1..N,1..M] of integer;
///Функция вычисления среднего арифметического элементов массива
Function Sr(A:Mass):real;
Var
i,j:integer;
Begin
result:=0;
For i:= 1 to N do
For j:= 1 to M do
result:=result+A[i,j];
result:=result/(M*N);
End;
Var
A:Mass;
B:array[1..N,1..M-1] of integer;
i,j,jMax,k:integer;
S,MaxS:real;
Begin
Randomize;
WriteLn('Исходная матрица:');
For i:= 1 to N do
Begin
For j:= 1 to M do
Begin
A[i,j]:=random(21)-10;
Write(A[i,j]:3,' ')
End;
WriteLn
End;
WriteLn('Среднее арифметическое её элементов: ',Sr(A));
WriteLn;
MaxS:=0;
jMax:=1;
For i:= 1 to N do
MaxS:=MaxS+A[i,1];
For j:= 2 to M do
Begin
S:=0;
For i:= 1 to N do
S:=S+A[i,j];
if S > MaxS then
Begin
jMax:=j;
MaxS:=S;
End;
End;
k:=0;
For j:= 1 to M do
if jMax <> j then
Begin
k:=k+1;
For i:= 1 to N do
B[i,k]:=A[i,j];
End;
WriteLn('Новая матрица:');
For i:= 1 to N do
Begin
For j:= 1 to M-1 do
Write(B[i,j]:3,' ');
WriteLn
End;
End.
Пример работы программы:
Исходная матрица:
10 6 10 2
3 5 -3 8
8 2 0 -9
Среднее арифметическое её элементов: 3.5
Новая матрица:
6 10 2
5 -3 8
2 0 -9