EDITOR.PAS 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. Uses CRT;
  2. {-------------------------------}
  3. Type Errors = record
  4. Pos : array [1..256] of byte;
  5. typeoferr : array [1..256] of byte;
  6. End; {errors}
  7. {-------------------------------}
  8. Var
  9. s1 : string;
  10. k,j : byte;
  11. NumOfWords, NumOfConv :byte;
  12. {-----------------------------------------------------}
  13. Function UpCas(s : char) : char;
  14. Begin
  15. if ord(s) in [128..175, 224..239] then
  16. begin
  17. if ord(s) in [160..175] then UpCas := Chr(ord(s) - 32);
  18. if ord(s) in [224..239] then UpCas := Chr(ord(s) - 80);
  19. end
  20. else UpCas := UpCase(s);
  21. end; {UpCas}
  22. {------------------------------------------------------------}
  23. Procedure Colored(pos : byte);
  24. Var i :byte;
  25. Begin
  26. Delay(2000);
  27. GotoXY(1,11);
  28. TextColor(LightGreen);
  29. for i := 1 to length(s1) do begin
  30. Write(s1[i]);
  31. if i = pos then TextColor(7);
  32. end;
  33. End; {Colored}
  34. {------------------------------------------------------------}
  35. Procedure Testing(Var s1:string);
  36. Begin
  37. For k := 1 to length(s1) do
  38. if s1[1] = ' ' then delete(s1,1,1);
  39. S1[1] := UpCas(s1[1]);
  40. For j := 1 to 15 do
  41. For k := 1 to length(s1) do
  42. if (s1[k] = ' ') and ((s1[k+1] = ',') or (s1[k+1] = '.')
  43. or (s1[K+1] = '!') or (s1[k+1] = ' ')) then delete(s1,k,1);
  44. For k := 1 to length(s1) do
  45. if ((s1[k] = ',') or (s1[k] = '.') or (s1[k] = '!'))
  46. and (s1[k+1] <> ' ') then insert(' ',s1,k+1);
  47. For k := 1 to length(s1) do
  48. if s1[k] = '.' then s1[k+2] := upcas(s1[k+2]);
  49. For k := 1 to length(s1) do if s1[length(s1)] = ' '
  50. then delete(s1,length(s1),1);
  51. Insert('.',s1,length(s1)+1);
  52. End; {Testing}
  53. {-----------------------------------------------------------}
  54. Procedure LOG(s1:string);
  55. Begin
  56. For k := 1 to length(s1) do begin
  57. if s1[k] = '.' then inc(NumOfConv);
  58. if s1[k] = ' ' then inc(NumOfWords);
  59. End;
  60. Inc(NumOfWords);
  61. GotoXY(2,13);
  62. Write('‚ᥣ® á«®¢ ¢ ⥪áâ¥: ', NumOfWords);
  63. GotoXY(2,14);
  64. Write('‚ᥣ® ¯à¥¤«®¦¥­¨© ¢ ⥪áâ¥: ', NumOfConv);
  65. End;{LOG}
  66. {---------------------------------------------------------}
  67. Begin
  68. ClrScr;
  69. GotoXY(10,10);
  70. Writeln('‚¢¥¤¨â¥ áâà®çªã ¤«ï । ªâ¨à®¢ ­¨ï: ');
  71. ReadLn(s1);
  72. Testing(s1);
  73. GotoXY(1,11);
  74. ClrEOL;
  75. Writeln(s1);
  76. Log(s1);
  77. GotoXY(80,25);
  78. ReadKey;
  79. End.