скачать рефераты
  RSS    

Меню

Быстрый поиск

скачать рефераты

 


                                             Нет

 



                                                                       Да


st:=st+ch;

 
Ромб: ch=#26

New(FEst); FEst^.s:=L^.s; FEst^.k:=L^.k; FEst^.p:=nil;

 
 



                                             Да

 


                          Нет

L:=L^.p; Est:=FEst;

 
Ромб: L<>nil
 



                                                        Нет

 


                                                                           Да

Ромб: L^.s>Est^.s

PEst:=Est; Est:=Est^.p;

 
 


                                                                                                                  Да

L^.k:=L^.k+1;

st:=''; b:=true; L:=L^.p;

 
 


                                                                   Нет

New(temp); temp^.s:=L^.s; temp^.k:=L^.k; temp^.p:=nil; PEst^.p:=temp;

 
Ромб: Est=nil
 



                                                                                      Да

 


                                                                   Нет


Ромб: (L^.s<Est^.s) and (Est<>Fest)
 


New(temp); temp^.s:=L^.s; temp^.k:=L^.k; temp^.p:=Est; PEst^.p:=temp;

 
                                                                                                        Да


 


                                                        Нет

Ромб: (L^.s<Est^.s) and (Est=FEst)
 



                                                                                                        Да

 



                                                                          Нет


 



                                Да


                    Нет


 




3   ТЕКСТ ПРОГРАММЫ

Program Project1;

{$APPTYPE CONSOLE}

Uses SysUtils;

type spisok=^Recspisok;

Recspisok=record

s:String; k:word; p:spisok; end;

var a,b,c,e:boolean; ch:char; st:string;

L,Fst,FEst,PEst,Est,temp:spisok; f:text;

label lb;

BEGIN

Fst:=nil;

Write('File >: '); ReadLn(st);

Assign(f,st); Reset(f); st:='';

REPEAT

L:=Fst;

a:=false; {a-признак конца слова}

b:=false; {b-признак наличия текущего слова в списке}

Read(f,ch);ch:=UpCase(ch);

{УДАЛЕНИЕ СЛОВ, ПЕЧАТАЕМЫХ ПРОЦЕДУРОЙ WRITE}

if ch='''' then begin

Repeat Read(f,ch); Until ch=''''; end;

{УДАЛЕНИЕ КОМЕНТАРИЕВ}

if ch='{' then begin

Repeat Read(f,ch); Until ch='}'; end;

{ПРОВЕРКА СИМВОЛА НА ПРИЗНАК КОНЦА СЛОВА}

if (ch=' ') or (ch='!') or (ch='"') or (ch='#') or (ch='$') or (ch='%') or

(ch='&')or(ch='*')or(ch='+')or(ch=',')or(ch='-')or(ch='.') or

(ch='/')or(ch=':')or(ch=';')or(ch='<')or(ch='=')or(ch='>')or

(ch='@')or(ch='[')or(ch=']')or(ch='\')or(ch='^')or(ch='`')or

(ch='|')or(ch='~')or(ch='(')or(ch=')')or(ch=#10)or(ch=#13)or(ch='}')

then a:=true;

{ЕСЛИ a=true, ТО СЛОВО СФОРМИРОВАНО. ПЕРЕХОДИМ К ПРОВЕРКЕ}

if (a=true) THEN BEGIN

IF (ST='BEGIN') THEN begin c:=false; e:=false; end;

IF (ST='TYPE') OR (ST='VAR') OR (ST='CONST') OR (ST='PROCEDURE') OR (ST='FUNCTION') THEN

begin c:=true; e:=false; ST:=''; end;

IF (ST='LABEL') THEN begin c:=true; e:=true; ST:=''; end;

{УДАЛЕНИЕ ЗАРЕЗЕРВИРОВАННЫХ СЛОВ}

if (st='AND')or(st='XOR')or(st='NOT')or(st='OR')or(st='DIV') or

(st='MOD')or(st='SHL')or(st='SHR')or(st='NIL')or(st='OBJECT') or

(st='ARRAY')or(st='FILE')or(st='OF')or(st='RECORD')or(st='SET') or

(st='BYTE')or(st='SHORTINT')or(st='WORD')or(st='INTEGER')or

(st='LONGINT')or(st='STRING')or(st='BOOLEAN')or(st='REAL')or

(st='DOUBLE')or(st='EXTENDED')or(st='COMP')or(st='CHAR')or(st='END')

or(st='TEXT') then st:='';

{--УДАЛЕНИЕ ЦИФР В ОПИСАНИИ ПЕРЕМЕННЫХ--}

if (e=false) and (c=true) and ((st[1]='0')or(st[1]='1')or(st[1]='2')or

(st[1]='3')or(st[1]='4')or(st[1]='5')or(st[1]='6')or(st[1]='7')or

(st[1]='8')or(st[1]='9')) then st:='';

{--УДАЛЕНИЕ ЦИФР В ПРОГРАММЕ--}

if (e=false) and (c=false) and ((st[1]='0')or(st[1]='1')or(st[1]='2')or

(st[1]='3')or(st[1]='4')or(st[1]='5')or(st[1]='6')or(st[1]='7')or

(st[1]='8')or(st[1]='9')) and (ch<>':') then st:='';

{УВЕЛИЧЕНИЕ СЧЕТЧИКА СЛОВА НА ЕДИНИЦУ. ЕСЛИ ЭТО СЛОВО УЖЕ ЕСТЬ}

while (L<>nil) and (st<>'') do begin

if L^.s=st then begin L^.k:=L^.k+1; st:=''; b:=true; L:=L^.p; end

else L:=L^.p; end;

{ДОБАВЛЕНИЕ СЛОВА. ЕСЛИ ЕГО НЕТ В СПИСКЕ}

if (b=false) and (st<>'') and (c=true) then begin L:=Fst;

New(Fst); Fst^.s:=st; Fst^.k:=1; Fst^.p:=L; L:=Fst; st:=''; end else st:='';

END ELSE st:=st+ch;

UNTIL ch=#26;

{ФОРМИРОВАНИЕ ОТСОРТИРОВАННОГО СПИСКА}

New(FEst); FEst^.s:=L^.s; FEst^.k:=L^.k; FEst^.p:=nil;

lb: L:=L^.p; Est:=FEst;

While L<>nil do BEGIN

IF L^.s>Est^.s THEN begin PEst:=Est; Est:=Est^.p; end;

Страницы: 1, 2, 3


Новости

Быстрый поиск

Группа вКонтакте: новости

Пока нет

Новости в Twitter и Facebook

  скачать рефераты              скачать рефераты

Новости

скачать рефераты

Обратная связь

Поиск
Обратная связь
Реклама и размещение статей на сайте
© 2010.