Advertisement
dimon2242

Untitled

Jul 10th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 1.23 KB | None | 0 0
  1. program P4C1DT;
  2. const
  3.     CHARS : set of char = ['B', 'C', 'D', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'V', 'W', 'X', 'Y', 'Z'];
  4.     SIG : set of char = ['.', ' '];
  5.  
  6. var
  7.     i, j, k: Integer;
  8.     strResults : string;
  9.     strLine : string[60];
  10.     sourceText : text;
  11. begin
  12.     k := 0;
  13.     assign(sourceText, 'sourceText.txt');
  14.     reset(sourceText);
  15.     strResults := '';
  16.     while(NOT EOF(sourceText)) do begin
  17.         j := 1;
  18.         readln(sourceText, strLine);
  19.         for i := 1 to length(strLine) do begin
  20.             if(upcase(strLine[i]) in SIG) then begin
  21.                 if(NOT((upcase(strLine[i-1]) in CHARS) and (upcase(strLine[j]) in CHARS))) then
  22.                     if((upcase(strLine[i-1]) in CHARS) or (upcase(strLine[j]) in CHARS)) then begin
  23.                         strResults := strResults + copy(strLine, j, i - j);
  24.                         strResults := strResults + ',';
  25.                         k := k + 1;
  26.                     end;
  27.                 j := i + 1;
  28.             end;
  29.         end;
  30.     end;
  31.     if(k <> 0) then
  32.         writeln(#10#13,'Количество слов, либо начинающихся, либо заканчивающихся на согласную букву: ', k, #10#13, #10#13, strResults, #10#13)
  33.     else
  34.         writeln(#10#13, 'Не слов, начинающихся либо заканчивающихся на согласную буквы');
  35. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement