Інформація про навчальний заклад

ВУЗ:
Національний університет Львівська політехніка
Інститут:
Не вказано
Факультет:
Не вказано
Кафедра:
Не вказано

Інформація про роботу

Рік:
2009
Тип роботи:
Звіт
Предмет:
Інші

Частина тексту файла (без зображень, графіків і формул):

Міністерство освіти та науки України Національний університет «Львівська політехніка»  Звіт про виконання практичної роботи №3 Мета: вивчення, освоєння масивів та робота з файлами. Умова завдання: Відкрити файл попередньої програми, відфільтрувати усі оператори. Результати фільтрування зберегти у файлі… Текст програми: Program file; var str,rez:string; a,b:text; i:integer; p:boolean; procedure char1(var i:integer); begin rez:=rez+str[i]; i:=i+1; end; function raz(var i:integer):boolean; begin if(str[i]='+') then begin char1(i); raz:=true; end else if(str[i]='-') then begin char1(i); raz:=true; end else if(str[i]='/') then begin char1(i); raz:=true; end else if(str[i]='*') then begin char1(i); raz:=true; end else if(str[i]='<') then begin char1(i); raz:=true; end else if(str[i]='>') then begin char1(i); raz:=true; end else if(str[i]='=') then begin if (str[i-1]=':') then rez:=rez+':'; char1(i); raz:=true; end else raz:=false; end; function dwa(var i:integer):boolean; var temp:string; c:boolean; j:integer; begin temp:=''; c:=false; j:=1; if(str[i]='w') then begin j:=1; c:=true; temp:='riteln'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='w') then begin j:=1; c:=true; temp:='hile'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='r') then begin j:=1; c:=true; temp:='eadln'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='b') then begin j:=1; c:=true; temp:='egin'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='d') then begin j:=1; c:=true; temp:='o'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='e') then begin j:=1; c:=true; temp:='nd'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='i') then begin j:=1; c:=true; temp:='f'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='t') then begin j:=1; c:=true; temp:='hen'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='f') then begin j:=1; c:=true; temp:='or'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='w') then begin j:=1; c:=true; temp:='hile'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='e') then begin j:=1; c:=true; temp:='lse'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='p') then begin j:=1; c:=true; temp:='rocedure'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end; temp:=''; c:=false; j:=1; if(str[i]='f') then begin j:=1; c:=true; temp:='unction'; while((j<=length(temp)) and (c) ) do if (str[i+j]<>temp[j]) then c:=false else j:=j+1; end; if (c) then begin dwa:=true; rez:=rez+str[i]+temp; i:=i+j+1; end else dwa:=false; end; procedure work; begin i:=1; while (i<=length(str)) do begin p:=raz(i); if (not p) then p:=dwa(i); if (not p) then begin i:=i+1; end; end; end; procedure lom; var i,j,h:integer; begin assign(a,'j:\rizne\lab3.txt'); assign(b,'j:\rizne\lab4.txt'); reset(a); rewrite(b); while not eof(a) do begin readln(a,str); rez:=''; work; if (length(rez)>0) then writeln(b,rez); end; end; begin lom; close(a); close(b); end. Результати: файл lab4.txt: = do =do procedure begin for:=do for:=do begin = end end procedure begin for:=do begin for:=do writeln end readln end procedure begin for:=do begin for:=do begin := :=- while><do begin +:= :=- end +:= end end end function begin := if<>then begin for:=-do:=+ :=/- writeln= end else := end function begin := for:=-do begin := :=* end := writeln end begin writeln writeln writeln end
Антиботан аватар за замовчуванням

01.01.1970 03:01-

Коментарі

Ви не можете залишити коментар. Для цього, будь ласка, увійдіть або зареєструйтесь.

Ділись своїми роботами та отримуй миттєві бонуси!

Маєш корисні навчальні матеріали, які припадають пилом на твоєму комп'ютері? Розрахункові, лабораторні, практичні чи контрольні роботи — завантажуй їх прямо зараз і одразу отримуй бали на свій рахунок! Заархівуй всі файли в один .zip (до 100 МБ) або завантажуй кожен файл окремо. Внесок у спільноту – це легкий спосіб допомогти іншим та отримати додаткові можливості на сайті. Твої старі роботи можуть приносити тобі нові нагороди!
Нічого не вибрано
0%

Оголошення від адміністратора

Антиботан аватар за замовчуванням

Подякувати Студентському архіву довільною сумою

Admin

26.02.2023 12:38

Дякуємо, що користуєтесь нашим архівом!