Скачиваний:
329
Добавлен:
04.03.2014
Размер:
2 Кб
Скачать
program tolik23{Ї®¤бзЁвлў Ґв б।­ҐҐ Є®«-ў® ЎгЄў ў б«®ўҐ Ё б।­ҐҐ
               Є®«-ў® б«®ў ў ЇаҐ¤«®¦Ґ­ЁЁ};
         uses crt;
        var
        st:string;

PROCEDURE probelitotshka (st1:string;var st2:string);
                          var i:integer;
begin
     i:=0;
     while i<=length(st1)-1 do
     if(st1[i+1]=' ') and (st1[i]='.')  then
     delete(st1,i+1,1)
     else
     i:=i+1;
     i:=0;
     while i<=length(st1)-1 do
     if(st1[i+1]='.') and (st1[i]=' ')  then
     delete(st1,i,1)
     else
     i:=i+1;
     i:=0;
     while i<=length(st1)-1 do
     if(st1[i]=st1[i+1]) and (st1[i]=' ')  then
     delete(st1,i,1)
     else
     i:=i+1;
     i:=0;
     while i<=length(st1)-1 do
     if(st1[i]=st1[i+1]) and (st1[i]='.')  then
     delete(st1,i,1)
     else
     i:=i+1;
     if (st1[1]=' ') or (st1[1]='.') then delete(st1,1,1);
     st2:=st1;
end;

Function slowo(s:string):real;
     VAr i:integer;
     n,k:integer;
BEGIN
   n:=0;k:=0;
    for i:=1 to length(s) do
        if (s[i]<>' ') and (s[i]<>'.') then k:=k+1
   else  n:=n+1;
   slowo:=k/n;
end;

FUNCTION predlog(a:string):real;
                 var x,y,j:integer;
begin
     x:=0;y:=0;
    for j:=1 to length(a) do
       begin
   if (a[j]=' ') or (a[j]='.') then x:=x+1;
   if a[j]='.' then y:=y+1;
       end;
   predlog:=x/y;
end;

begin
   clrscr;
   writeln('ўўҐ¤ЁвҐ бва®Єг');
   read(st);
   st:=st+' ';
   probelitotshka(st,st);Writeln(st);
   Writeln('‘।­ҐҐ Є®«-ў® ЎгЄў ў б«®ўҐ ',slowo(st):4:2);
   Writeln('‘।­ҐҐ Є®«-ў® б«®ў ў ЇаҐ¤«®¦Ґ­ЁЁ ',predlog(st):4:2);
   readln;
   readln;
end.

Соседние файлы в папке Alex