Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. function SizeOfMatrix(MyFile: TextFile) : integer;
  2. var
  3. numb, n, numbEx: integer;
  4. isCorrect, firstIt: boolean;
  5. begin
  6. n := 0;
  7. numb := 0;
  8. firstIt := true;
  9. isCorrect := true;
  10. while (not eof(MyFile)) and isCorrect do
  11. begin
  12. numbEx := numb;
  13. numb := 0;
  14. while not eoln(MyFile) do
  15. begin
  16. inc(numb);
  17. read (MyFile, numb);
  18. end;
  19. if numbEx <> numb then
  20. isCorrect := false;
  21. if firstIt then
  22. begin
  23. isCorrect := true;
  24. firstIt := false;
  25. end;
  26. inc(n);
  27. readln(MyFile);
  28. end;
  29. if isCorrect and (numb = n) then
  30. Result := n
  31. else
  32. Result := 0;
  33. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement