Welcome, guest! Login / Register - Why register?

Paste

N/A
Pasted by kail ( 12 years ago )
Program Program_1;
Uses  CRT;
Const FileNameIn='Incoming.txt';
      FileNameOut='Outgoing.txt';
Var   F1,F2:Text;
      S,Word:string[128];
      AmountWord,i:byte;

procedure EndWord;
begin
  if Word<>'' then
    begin
      WriteLn(F2,'( ',Word,' )');
      Word:='';
      inc(AmountWord);
    end;
end;

begin
  ClrScr;
  AmountWord:=0;
  Assign(F1,FileNameIn);
  Assign(F2,FileNameOut);
  Reset(F1);
  Rewrite(F2);
  While Not SeekEoF(F1) do
    begin
      ReadLn(F1,S);
      for i:=1 to length(S) do
        if ord(s[i])=32 then EndWord else Word:=Word+S[i];
      EndWord;
    end;
   Close(F1);
  Close(F2);
  Write('V ukazannom tekstovom faile ',AmountWord,' slov.');
  Read(s);
end.

 

Revise this Paste

Your Name: Code Language: