Люди помогите, дана программа и ее модуль и нужно составить по ней блок схему алгоритма вот сама программа с ее модулем
Программа:
Код:
uses
main;
function GetFileName: String;
var
Result: String;
begin
Write('Input filename: '); ReadLn(Result);
GetFileName := Result;
end;
var
ar: TArray;
vec: TVector;
begin
while (true) do
case Menu Of
1: Load(GetFileName, ar);
2: Save(GetFileName, ar);
3: InputArray(ar);
4: PrintArray(ar);
5: GetSumNegInLine(ar, vec);
6: PrintVec(vec);
7: Exit;
end;
end.
Модуль:
Код:
unit main;
interface
type
TxCount = 1..7;
TyCount = 1..5;
TLine = Array[TyCount] Of Integer;
TArray = Array[TxCount] Of TLine;
TVector = Array[TxCount] Of Integer;
function Menu: Byte;
procedure Load(const fName: String; var ar: TArray);
procedure Save(const fName: String; const ar: TArray);
procedure InputArray(var ar: TArray);
procedure PrintArray(const ar: TArray);
procedure GetSumNegInLine(const x: TArray; var y: TVector);
procedure PrintVec(const ar: TVector);
implementation
function Menu: Byte;
var
Result: Byte;
begin
repeat
WriteLn('1. Load array from file');
WriteLn('2. Save array to file');
WriteLn('3. Input array');
WriteLn('4. Print array');
WriteLn('5. Generate vector of negatives elem. sum');
WriteLn('6. Print vector');
WriteLn('7. Exit');
ReadLn(Result);
until (Result in [1..7]);
Menu := Result;
end;
procedure Load(const fName: String; var ar: TArray);
var
f: Text;
i: TxCount;
j: TyCount;
begin
Assign(f, fName); Reset(f);
for i := Low(TxCount) to High(TxCount) do
begin
for j := Low(TyCount) to High(TyCount) do
Read(f, ar[i, j]);
ReadLn(f);
end;
Close(f);
end;
procedure Save(const fName: String; const ar: TArray);
var
f: Text;
i: TxCount;
j: TyCount;
begin
Assign(f, fName); ReWrite(f);
for i := Low(TxCount) to High(TxCount) - 1 do
begin
for j := Low(TyCount) to High(TyCount) do
Write(f, ' ', ar[i, j]);
WriteLn(f);
end;
for j := Low(TyCount) to High(TyCount) do
Write(f, ' ', ar[High(TxCount), j]);
Close(f);
end;
procedure InputArray(var ar: TArray);
var
i: TxCount;
j: TyCount;
begin
for i := Low(TxCount) to High(TxCount) - 1 do
for j := Low(TyCount) to High(TyCount) do
begin
Write('ar[', i, '][', j, ']=');
ReadLn(ar[i, j]);
end;
end;
procedure PrintArray(const ar: TArray);
var
i: TxCount;
j: TyCount;
begin
WriteLn; WriteLn;
for i := Low(TxCount) to High(TxCount) - 1 do
begin
for j := Low(TyCount) to High(TyCount) do
Write(ar[i, j]:7);
WriteLn;
end;
end;
function SumNegInLine(const x: TLine): Integer;
var
Result: Integer;
j: TyCount;
begin
Result := 0;
for j := Low(TyCount) to High(TyCount) do
if (x[j] < 0)
then
Inc(Result, x[j]);
SumNegInLine := Result;
end;
procedure GetSumNegInLine(const x: TArray; var y: TVector);
var
i: TxCount;
begin
for i := Low(TxCount) to High(TxCount) - 1 do
y[i] := SumNegInLine(x[i]);
end;
procedure PrintVec(const ar: TVector);
var
i: TxCount;
begin
WriteLn; WriteLn;
for i := Low(TxCount) to High(TxCount) - 1 do
Write(ar[i]:7);
WriteLn;
end;
end.
А вот пример схемы как нужно составить( я так и не понял).