Advertisement
Guest User

Untitled

a guest
Nov 13th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 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. while not eoln(MyFile) do
  14. begin
  15. inc(numb);
  16. read (MyFile, numb);
  17. end;
  18. if numbEx <> numb then
  19. isCorrect := false;
  20. if firstIt then
  21. begin
  22. isCorrect := true;
  23. firstIt := false;
  24. end;
  25. inc(n);
  26. readln(MyFile);
  27. end;
  28. if isCorrect and (numb = n) then
  29. Result := n
  30. else
  31. Result := 0;
  32. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement