Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program project1;
- const
- ZNAK = ['.', ',', ':', ';', '!', '?', '-', ' ','/'];
- CHECK = ['0','1','2','3','4','5','6','7','8','9'];
- var
- t:Text;
- s,pyt: String;
- h:char;
- i,j,f,n, LenS, dlinc : Integer;
- begin
- f:=0;
- n:=1;
- dlinc := 0;
- pyt:= 't.txt';
- writeln('Файл',pyt);
- Assign(t,pyt);
- Reset(t);
- while not Eof(t) do
- begin
- readln(t,s);
- LenS := Length(S);
- for i := 1 to LenS do
- if not (S[i] in ZNAK) then
- begin
- Inc(dlinc);
- if (i = LenS) or (S[i + 1] in ZNAK) then
- begin
- if dlinc >= 5 then
- begin
- for j:= 1 to 5 do
- begin
- h:=s[j];
- if h in CHECK then
- begin
- val(h,f);
- n:=f*n;
- end
- else delete(s,1,dlinc);
- end;
- if n mod 2 = 0 then write(' Chetnoe = ',n)
- else write (' Necnetnoe = ',n); //Проверка на четноесть нечетноесть
- n:=1;
- delete(s,1,dlinc);
- end
- else
- begin
- delete(s,1,dlinc);
- dlinc := 0;
- writeln('dlina menshe 5i = ', s);
- end;
- end;
- end;
- end;
- Close(t);
- Readln;
- end.
Add Comment
Please, Sign In to add comment