klasscho

Untitled

Nov 18th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. procedure ReadMatrix(var Matrixx: MatrixType; FName: string);
  2. var
  3. MyFileInPut: TextFile;
  4. i, j, n: Integer;
  5. Arr: array of array of Integer;
  6. begin
  7. AssignFile(MyFileInPut, FName);
  8. Reset(MyFileInPut);
  9. for i := 0 to n - 1 do
  10. for j:=0 to n - 1 do
  11. Read(myFileInput, Matrixx[i, j]);
  12. CloseFile(MyFileInPut);
  13. end;
  14.  
  15. function Average(MatrixType = array of array of Integer; n: integer): Real;
  16. var
  17. Sum, Amount, i, j: Integer;
  18. begin
  19. Sum := 0;
  20. Amount := 0;
  21. for i := 0 to n - 1 do
  22. for j := 0 to n - 1 do
  23. if MatrixType[j, i] > 0 then
  24. begin
  25. Sum := Sum + MatrixType[j, i];
  26. Inc(Amount);
  27. end;
  28. Average := Sum/Amount;
  29. end;
Advertisement
Add Comment
Please, Sign In to add comment