
bogodukhov_s_i_sinyukhin_a_v_kozik_e_s_kurs_materialovedeniy
.pdfПРИЛОЖЕНИЯ |
341 |
|
|
var ss:string; ii:real; jj:integer; begin readln(ss); val(ss,ii,jj);
if jj0 then ii:=0; readreal:=ii end;
procedure readfile(ss:string); var ii:byte;
begin
if ss='' then begin
readln(f,m1);readln(f,m2);
for ii:=1 to 8 do readln(f,d[ii]); for ii:=1 to 12 do readln(f,s[ii]); for ii:=1 to 5 do readln(f,t[ii]) end else
begin
assign(f,ss); reset(f); readln(f,m1);
for ii:=1 to 5 do readln(f,n[ii]) end
end;
function kod(ss:string):string; var ii:byte;
begin ii:=0;
while ii<length(ss) do begin
ii:=ii+1; case ss[ii] of
' ': begin ss:=copy(ss,1,ii 1)+copy(ss,ii+1,length(ss) ii); ii:=ii 1 end; 'a','А','а': ss[ii]:='A';
'b','В','в': ss[ii]:='B'; 'c','С','с': ss[ii]:='C'; 'e','Е','е': ss[ii]:='E'; 'h','Н','н': ss[ii]:='H'; 'k','К','к': ss[ii]:='K'; 'm','М','м': ss[ii]:='M';

342 КУРС МАТЕРИАЛОВЕДЕНИЯ В ВОПРОСАХ И ОТВЕТАХ
'n','П','п': ss[ii]:='N'; 'o','О','о','0': ss[ii]:='O'; 'p','Р','р': ss[ii]:='P'; 't','Т','т': ss[ii]:='T'; 'u','И','и': ss[ii]:='U'; 'x','Х','х': ss[ii]:='X'; 'y','У','у': ss[ii]:='Y'; 'd': ss[ii]:='D';
'f': ss[ii]:='F'; 'g': ss[ii]:='G'; 'i': ss[ii]:='I'; 'j': ss[ii]:='J'; 'n': ss[ii]:='N'; 'q': ss[ii]:='Q'; 'r': ss[ii]:='R'; 's': ss[ii]:='S'; 'v': ss[ii]:='V'; 'w': ss[ii]:='W'; 'z': ss[ii]:='Z'; 'б': ss[ii]:='Б'; 'г': ss[ii]:='Г'; 'д': ss[ii]:='Д'; 'ж': ss[ii]:='Ж'; 'з': ss[ii]:='З'; 'й': ss[ii]:='Й'; 'л': ss[ii]:='Л'; 'ф': ss[ii]:='Ф'; 'ц': ss[ii]:='Ц'; 'ч': ss[ii]:='Ч'; 'ш': ss[ii]:='Ш'; 'щ': ss[ii]:='Щ'; 'ь': ss[ii]:='Ь'; 'ы': ss[ii]:='Ы'; 'ъ': ss[ii]:='Ъ'; 'э': ss[ii]:='Э'; 'ю': ss[ii]:='Ю'; 'я': ss[ii]:='Я'; end end; kod:=ss
end;
procedure out;
ПРИЛОЖЕНИЯ |
343 |
|
|
begin
textcolor(7); textbackground(0); clrscr;
gotoxy(1,1); write('Название '); textcolor(15); write(m1); gotoxy(41,1); textcolor(7); write('Марки '); textcolor(15); write(m2);
gotoxy(4,2); textcolor(7);
writeln('— Детали машин и области применения — ); for i:=1 to 8 do writeln(d[i]);
gotoxy(4,11);
writeln('— Свойства. Основные критерии работоспособности — ');
for i:=1 to 12 do writeln(s[i]); gotoxy(1,24);
for i:=1 to 5 do if (n[i]>'') and (t[i]>0) then begin
gotoxy(i*16 15,24); write(n[i],'=',t[i]:6:1) end;
textcolor(15); gotoxy(4,25);
write('"Enter '#27' " продолжение, "F2" вывод в файл,'); write(' "Esc" конец работы')
end;
procedure save; begin
writeln(l,'Название ',m1); writeln(l,'Марки ',m2);
writeln(l,#9'Детали машин и область применения'); for i:=1 to 8 do if d[i]>'' then writeln(l,d[i]);
writeln(l,#9'Свойства. Основные критерии работоспособности'); for i:=1 to 12 do if s[i]>'' then writeln (l,s[i]);
for i:=1 to 5 do if (n[i]>'') and (t[i]>0)
then writeln(l,' ',n[i],' ':10 length(n[i]),'=',t[i]:6:1); writeln(l)
end;
begin gettime(h1,l1,s1,s101); s101:=s1+l1*60+h1*3600; clr;
nn:=1; p:=1; findfirst('*.bz',32,dd); ff[nn]:=dd.name;

344 КУРС МАТЕРИАЛОВЕДЕНИЯ В ВОПРОСАХ И ОТВЕТАХ
if doserror0 then goto not_found; assign(f,ff[nn]); reset(f); readln(f,r[nn]);
for i:=1 to 5 do readln(f,rn[nn,i]); close(f);
ins[nn]:=false; repeat nn:=nn+1;
findnext(dd); ff[nn]:=dd.name; assign(f,ff[nn]); reset(f); readln(f,r[nn]);
for i:=1 to 5 do readln(f,rn[nn,i]); close(f);
ins[nn]:=false;
until (doserror0) or (nn>100); nn:=nn 1;
clrscr; textcolor(15);
write(' Выберите файлы для поиска',' ': 30,'(',nn,' файлов)'); gotoxy(4,25);
write('"SpaceBar", "Enter '#27' " отметить файл,'); write(' "Esc", "F10" конец выбора');
if nn>p+22 then j:=p+22 else j:=nn; for i:=p to j do
begin
if ins[i] then textcolor(15) else textcolor(7); gotoxy(1,2+i p); write(ff[i]); gotoxy(20,2+i p); write(r[i]);
if ins[i] then begin gotoxy(17,2+i p); write('*') end end;
i:=1; repeat
if ins[i] then textcolor(15) else textcolor(0); textbackground(7);
gotoxy(1,2+i p); write(ff[i]); gotoxy(20,2+i p); write(r[i]); gotoxy(17,2+i p); textbackground(0);
if ins[i] then write('*') else write(' '); c:=readkey;
if ins[i] then textcolor(15) else textcolor(7); gotoxy(1,2+i p); write(ff[i]); gotoxy(20,2+i p); write(r[i]);
if c=#0 then c:=readkey;
ПРИЛОЖЕНИЯ |
345 |
|
|
if (c=' ') or (c=#13) or (c='R') then
if ins[i] then ins[i]:=false else ins[i]:=true; if c='H' then
if i>1 then i:=i 1; if p>i then begin p:=i; scrollwindowdown(1,2,80,24,1) end;
if c='P' then
if i<nn then i:=i+1; if p<i 22 then begin p:=i 22; skrollwindowup(1,2,80,24.1) end;
until (c=#27) or (c='D') or (c=' '); j:=0;
for i:=1 to nn do if ins[i] then j:=j+1; if j=0 then goto not_found; window(21,9,60,15);
textcolor(0); textbackground(7); clrskr;
framewindow(23,10,58,14,112,112,' Выбор метода поиска '); window(1,1,80,25);
r[1]:=' Поиск по характеристикам '; r[2]:=' Поиск по области применения '; r[3]:=' Просмотр всей базы '; textcolor(15);
for m:=1 to 3 do begin gotoxy(25,10+m); writeln(r[m]) end; m:=1;
repeat textbackground(0);
gotoxy(25,10+m); write(r[m]); c:=readkey; textbackground(7); gotoxy(25,10+m); write(r[m]); if c=#0 then c:=readkey;
if c='H' then m:=m 1; if c='P' then m:=m+1; if m=0 then m:=3;
if m=4 then m:=1;
until (c=#27) or (c='D') or (c=' ') or (c=#13); case m of
1: begin clr; p:=0;
for i:=1 to nn do if ins[i] then for j:=1 to 5 do
begin

346 КУРС МАТЕРИАЛОВЕДЕНИЯ В ВОПРОСАХ И ОТВЕТАХ
for i_:=1 to p do begin
if (kod(rn[i,j])=kod(r[i_])) or (rn[i,j]='') then goto nto
end;
p:=p+1; r[p]:=rn[i,j]; if p>22 then goto ont; nto:
end;
ont:
if p=0 then goto not_found; clrscr; textcolor(15);
write('Выберите характеристики для поиска'); gotoxy(1,25);
write('"Enter '#27' " ввод диапазона значений,'); write(' "Esc", "F10" конец выбора');
gotoxy(1,2); textcolor(7); for i:=1 to p do
begin
writeln(' ',r[i],' '); fn[i,1]:=0; fn[i,2]:=0 end;
i:=1; repeat
textcolor(0); textbackground(7); gotoxy(1,1+i); write(' ',r[i],' '); c:=readkey;
textcolor(7); textbackground(0); gotoxy(1,1+i); write(' ',r[i],' '); if c=#0 then c:=readkey;
if c=#13 then begin
gotoxy(20,1+i); write('от '); clreol; fn[i,1]:=readreal; if fn[i,1]0 then begin
gotoxy(30,1+i); write('до '); fn[i,2]:=readreal; if fn[i,2]=0 then fn[i,2]:=fn[i,1]
end;
gotoxy(20,1+i); clreol; if fn[i,1]0 then begin if fn[i,1]>fn[i,2] then
begin fn[24,1]:=fn[i,1]; fn[i,1]:=fn[i,2]; fn[i,2]:=fn[24,1] end; write(fn[i,1]:6:1,' ... ',fn[i,2]:6:1)
ПРИЛОЖЕНИЯ |
347 |
|
|
end end;
if (c='H') and (i>1) then i:=i 1; if (c='P') and (i<p) then i:=i+1; until (c=#27) or (c='D');
j:=0;
for i:=1 to p do if fn[i,1]0 then j:=j+1; if g=0 then goto not_found
end;
2: begin window(1,9,80,16);
textcolor(7); textbackground(0); clrscr;
framewindow(3,10,78,15,7,7,' Область применения '); window(5,12,76,14);
gotoxy(1,1); readln(m1); m1:=m1+' '; gotoxy(1,2); readln(m2); m2:=m2+' '; window(1,1,80,25);
g:=1; p:=0;
for i:=1 to length(m1) do
if (m1[i]=' ') or (m1[i]=' ') or (m1[i]='(') or (m1[i]=')') or (m1[i]=';') or (m1[i]=':') or (m1[i]='"') or (m1[i]='''') or (m1[i]=',') or (m1[i]='.')
then begin p:=p+1;
r[p]:=copy(m1,jji j);
if length(r[p])<4 then p:=p 1; j:=i+1
end;
j:=1;
for i:=1 to length(m2) do
if (m2[i]=' ') or (m2[i]=' ') or (m2[i]='(') or (m2[i]=')') or (m2[i]=';') or (m2[i]=':') or (m2[i]='"') or (m1[i]='''') or (m2[i]=',') or (m2[i]='.')
then begin p:=p+1;
r[p]:=copy(m2,j,i j);
if length(r[p])<4 then p:=p 1; j:=j+1
end;
if p=0 then goto not_found; for i:=1 to p do

348 КУРС МАТЕРИАЛОВЕДЕНИЯ В ВОПРОСАХ И ОТВЕТАХ
r[i]:=copy(r[i],1,round(length(r[i])/1.5)) end
end;
textcolor(7); textbackground(0); gotoxy(1,25);
write('Введите имя файла для вывода результатов < material.lst > : '); clreol; readln(m1);
if m1='' then m1:='material.lst'; assign(l,m1); rewrite(l);
for i_:=1 to nn do if ins[i_] then begin
readfile(ff[i_]); repeat
clr; readfile(''); ins[1]:=false; if keypressed then
begin c:=readkey;
it c=#0 then c:=readkey;
if (c=#27) or (c='D') then begin close(f); goto quit end end;
case m of 1: begin
for j:=1 to 5 do for i:=1 to p do
if (n[j]=r[i]) and (t[i]>=fn[i,1]) and (t[i]<=fn[i,2]) and (t[i]>0) then ins[1]:=true
end;
2: begin
for j:=1 to 12 do for i:=1 to p do
if pos(kod(r[i]),kod(d[j]))>0 then ins[1]:=true end;
3: ins[1]:=true end;
if ins[1] then begin out;
c:=readkey; if c=#0 then c:=readkey; if c='<' then save;
if (c=#27) or (c='D') then begin close(f); goto quit end end;
until eof(f); close(f) end; goto quit;
not_found: textcolor(7); textbackground(0); clrscr; writeln('Файлы для поиска не найдены или не выбраны.');
ПРИЛОЖЕНИЯ |
349 |
|
|
exit;
quit: close(1);
textcolor(7); textbackground(0); clrscr; gettime(h2,l2,s2,s102); s102:=s2+l2*60+h2*3600; s101:=s102 s101; h1:=s101 div 3600; s101:=s101 h1*3600; l1:=s101 div 60; s1:=s101 l1*60; write('Работа окончена. Вы работали '); if h1>0 then write(h1,' час(а), ');
if l1>0 then write(l1,' минут(ы), '); writeln(s1,' секунд(ы).')
end.
