I've written a programm which fill the different data about workers into the table. (Name, last Name and salary)
Help me write a procesure or function which look for the maximum salary value and a name of this worker and write it in console
Can i make it using a loop?
program labasix;
type firma = record
name : string;
lastName : string;
salary : integer;
end;
var
svitoch : array[1..12] of firma;
i : integer;
countOfWorkers : integer;
begin
write('Number of workers (not more than 12): ');
readln(countOfWorkers);
writeln();
for i := 1 to countOfWorkers do
begin
write('Name: '); readln( svitoch[i].name );
write('lastName: '); readln( svitoch[i].lastName );
write('Salary: '); readln( svitoch[i].salary );
writeln();
end;
for i := 1 to countOfWorkers do
begin
{ what code must be here ??? }
end;
end.
There must be something like this
procedure findMax(x, y, z: integer; var m: integer);
begin
if x > y then
m:= x
else
m:= y;
if z > m then
m:= z;
end;
But how to get x y z values?
Thank You so much !