Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
DIPLOM_33__33__33__33 / Vlasov_Zapiska_Diploma.docx
Скачиваний:
60
Добавлен:
12.06.2015
Размер:
16.04 Mб
Скачать

Приложение а

Часть кода программы, сравнение данных.

procedure TFirst.Button6Click(Sender: TObject);

….

begin

h:=0;

for ij:=1 to 50 do

for ji:=1 to 50 do

begin

mainform.stringgrid4.Cells[ij,ji]:='0';

end;

for ij:=0 to 50 do

for ji:=0 to 50 do

col[ij,ji]:=0;

If k<5 then showmessage('Вы выбрали меньше 5 параметров ')

else

begin

// длина

if Edit99.Visible=true then

begin

for ij:=1 to p-1 do

If abs(StrtoFloat(Edit99.Text)-StrtoFloat(ar[ij,5])) <=StrtoFloat(Edit102.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If Edit99.Text=ar[ij,5] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//ширина

if Edit100.Visible=true then

begin

for ij:=1 to p-1 do

If abs(StrtoFloat(Edit100.Text)-StrtoFloat(ar[ij,6])) <=StrtoFloat(Edit103.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If Edit100.Text=ar[ij,6] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//высота

if Edit101.Visible=true then

begin

for ij:=1 to p-1 do

If abs(StrtoFloat(Edit101.Text)-StrtoFloat(ar[ij,7])) <=StrtoFloat(Edit104.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If Edit101.Text=ar[ij,7] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//дальность макс

if Edit34.Visible=true then

begin

for ij:=1 to p-1 do

If abs(StrtoFloat(Edit34.Text)-StrtoFloat(ar[ij,1])) <=StrtoFloat(Edit71.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If Edit34.Text=ar[ij,1] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//дальность мин

if Edit35.Visible=true then

begin

for ij:=1 to p-1 do

If abs(StrtoFloat(Edit35.Text)-StrtoFloat(ar[ij,2])) <=StrtoFloat(Edit72.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If Edit35.Text=ar[ij,2] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//грузоподъёмность

if (Edit36.Visible=true) then

begin

for ij:=1 to p-1 do

If Edit36.Text=ar[ij,3] then

begin

kol1[ij]:=kol1[ij]+1;

end;

for ij:=1 to p-1 do

If abs(StrtoFloat(Edit36.Text)-StrtoFloat(ar[ij,3])) <=StrtoFloat(Edit73.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

end;

//объём грузов

if Edit37.Visible=true then

begin

for ij:=1 to p-1 do

If abs(StrtoFloat(Edit37.Text)-StrtoFloat(ar[ij,4])) <=StrtoFloat(Edit74.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If Edit37.Text=ar[ij,4] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//крейсерская скорость

if Edit38.Visible=true then

begin

for ij:=1 to p-1 do

If abs(StrtoFloat(Edit38.Text)-StrtoFloat(ar[ij,8])) <=StrtoFloat(Edit75.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If Edit38.Text=ar[ij,8] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//назначение самолёта

if Edit39.Visible=true then

begin

for ij:=1 to p-1 do

If Edit39.Text=ar[ij,9] then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If Edit39.Text=ar[ij,9] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//практический потолок

if (Edit40.Visible=true) then

begin

for ij:=1 to p-1 do

if (ar[ij,10]<>'-') then

If abs(StrtoFloat(Edit40.Text)-StrtoFloat(ar[ij,10])) <=StrtoFloat(Edit76.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

if (ar[ij,10]<>'-') then

If Edit40.Text=ar[ij,10] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//максимальная скорость

if (Edit41.Visible=true) then

begin

for ij:=1 to p-1 do

If (ar[ij,11]<>'-') then

If abs(StrtoFloat(Edit41.Text)-StrtoFloat(ar[ij,11])) <=StrtoFloat(Edit77.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,11]<>'-') then

If Edit41.Text=ar[ij,11] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//Масса топлива

if Edit42.Visible=true then

begin

for ij:=1 to p-1 do

If (ar[ij,12]<>'-') then

If abs(StrtoFloat(Edit42.Text)-StrtoFloat(ar[ij,12])) <=StrtoFloat(Edit78.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,12]<>'-') then

If Edit42.Text=ar[ij,12] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//Масса пустого самолёта

if Edit43.Visible=true then

begin

for ij:=1 to p-1 do

If (ar[ij,13]<>'-') then

If abs(StrtoFloat(Edit43.Text)-StrtoFloat(ar[ij,13])) <=StrtoFloat(Edit79.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,13]<>'-') then

If Edit43.Text=ar[ij,13] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//Масса снаряжённого самолёта

if Edit44.Visible=true then

begin

for ij:=1 to p-1 do

If (ar[ij,14]<>'-') then

If abs(StrtoFloat(Edit44.Text)-StrtoFloat(ar[ij,14])) <=StrtoFloat(Edit80.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,14]<>'-') then

If Edit44.Text=ar[ij,14] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//экипаж

if Edit45.Visible=true then

begin

for ij:=1 to p-1 do

If (ar[ij,15]<>'-') then

If abs(StrtoFloat(Edit45.Text)-StrtoFloat(ar[ij,15])) <=StrtoFloat(Edit81.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,15]<>'-') then

If Edit45.Text=ar[ij,15] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//Длина ВВП,м

if Edit46.Visible=true then

begin

for ij:=1 to p-1 do

If (ar[ij,16]<>'-') then

If abs(StrtoFloat(Edit46.Text)-StrtoFloat(ar[ij,16])) <=StrtoFloat(Edit82.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,16]<>'-') then

If Edit46.Text=ar[ij,16] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//Длина пробега,м

if Edit47.Visible=true then

begin

for ij:=1 to p-1 do

If (ar[ij,17]<>'-') then

If Edit47.Text=ar[ij,17] then

begin

kol1[ij]:=kol1[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,17]<>'-') then

If abs(StrtoFloat(Edit47.Text)-StrtoFloat(ar[ij,17])) <=StrtoFloat(Edit83.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

end;

//Длина разбега,м

if Edit48.Visible=true then

begin

for ij:=1 to p-1 do

If (ar[ij,18]<>'-') then

If abs(StrtoFloat(Edit48.Text)-StrtoFloat(ar[ij,18])) <=StrtoFloat(Edit84.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,18]<>'-') then

If Edit48.Text=ar[ij,18] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//Год выпуска

if Edit49.Visible=true then

begin

for ij:=1 to p-1 do

If (ar[ij,19]<>'-') then

If abs(StrtoFloat(Edit49.Text)-StrtoFloat(ar[ij,19])) <=StrtoFloat(Edit94.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,19]<>'-') then

If Edit49.Text=ar[ij,19] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//модель двигателя

if Edit50.Visible=true then

for ij:=1 to p-1 do

If (ar[ij,20]<>'-') then

If Edit50.Text=ar[ij,20] then

begin

kol[ij]:=kol[ij]+1;

kol1[ij]:=kol1[ij]+1;

end;

//Тип двигателя

if Edit51.Visible=true then

for ij:=1 to p-1 do

If (ar[ij,21]<>'-') then

If Edit51.Text=ar[ij,21] then

begin

kol[ij]:=kol[ij]+1;

kol1[ij]:=kol1[ij]+1;

end;

//мощность двигателя

if (Edit52.Visible=true) then

begin

If (ar[ij,22]<>'-') then

for ij:=1 to p-1 do

If abs(StrtoFloat(Edit52.Text)-StrtoFloat(ar[ij,22])) <=StrtoFloat(Edit85.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

If (ar[ij,22]<>'-') then

for ij:=1 to p-1 do

If Edit52.Text=ar[ij,22] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//вес

if (Edit53.Visible=true) then

begin

for ij:=1 to p-1 do

If (ar[ij,23]<>'-') then

If abs(StrtoFloat(Edit53.Text)-StrtoFloat(ar[ij,23])) <=StrtoFloat(Edit86.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,23]<>'-') then

If Edit53.Text=ar[ij,23] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//средний часовой расход

if (Edit54.Visible=true) then

Begin

for ij:=1 to p-1 do

If (ar[ij,24]<>'-') then

If abs(StrtoFloat(Edit54.Text)-StrtoFloat(ar[ij,24])) <=StrtoFloat(Edit87.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,24]<>'-') then

If Edit54.Text=ar[ij,24] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//размах крыла

if (Edit55.Visible=true) then

begin

for ij:=1 to p-1 do

If (ar[ij,25]<>'-') then

If abs(StrtoFloat(Edit55.Text)-StrtoFloat(ar[ij,25])) <=StrtoFloat(Edit88.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,25]<>'-') then

If Edit55.Text=ar[ij,25] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//длина самолёта

if (Edit56.Visible=true) then

begin

for ij:=1 to p-1 do

If (ar[ij,26]<>'-') then

If abs(StrtoFloat(Edit56.Text)-StrtoFloat(ar[ij,26])) <=StrtoFloat(Edit89.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,26]<>'-') then

If Edit56.Text=ar[ij,26] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//высота самолёта

if (Edit57.Visible=true) then

begin

for ij:=1 to p-1 do

If (ar[ij,27]<>'-') then

If abs(StrtoFloat(Edit57.Text)-StrtoFloat(ar[ij,27])) <=StrtoFloat(Edit90.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,27]<>'-') then

If Edit57.Text=ar[ij,27] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//площадь крыла

if (Edit58.Visible=true) then

begin

for ij:=1 to p-1 do

If (ar[ij,28]<>'-') then

If abs(StrtoFloat(Edit58.Text)-StrtoFloat(ar[ij,28])) <=StrtoFloat(Edit91.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,28]<>'-') then

If Edit58.Text=ar[ij,28] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//стреловидность

if (Edit59.Visible=true) then

begin

for ij:=1 to p-1 do

If (ar[ij,29]<>'-') then

If abs(StrtoFloat(Edit59.Text)-StrtoFloat(ar[ij,29])) <=StrtoFloat(Edit92.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,29]<>'-') then

If Edit59.Text=ar[ij,29] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//погодные условия

if (Edit60.Visible=true) then

for ij:=1 to p-1 do

If (ar[ij,30]<>'-') then

If Edit60.Text=ar[ij,30] then

begin

kol[ij]:=kol[ij]+1;

kol1[ij]:=kol1[ij]+1;

end;

//пассажир

if (Edit61.Visible=true) then

for ij:=1 to p-1 do

If (ar[ij,31]<>'-') then

If Edit61.Text=ar[ij,31]then

begin

kol[ij]:=kol[ij]+1;

kol1[ij]:=kol1[ij]+1;

end;

//стоимость

if (Edit62.Visible=true) then

begin

for ij:=1 to p-1 do

If (ar[ij,32]<>'-') then

If abs(StrtoFloat(Edit62.Text)-StrtoFloat(ar[ij,32])) <=StrtoFloat(Edit93.Text) then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,32]<>'-') then

If Edit62.Text=ar[ij,32] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//рампа

if (Edit63.Visible=true) then

for ij:=1 to p-1 do

If (ar[ij,33]<>'-') then

If Edit63.Text=ar[ij,33]then

begin

kol[ij]:=kol[ij]+1;

kol1[ij]:=kol1[ij]+1;

end;

//качество

if (Edit64.Visible=true) then

for ij:=1 to p-1 do

If (ar[ij,34]<>'-') then

If Edit63.Text=ar[ij,34] then

begin

kol[ij]:=kol[ij]+1;

end;

//катострофы

if (Edit65.Visible=true) then

begin

for ij:=1 to p-1 do

If (ar[ij,35]<>'-') then

If abs(StrtoFloat(Edit62.Text)-StrtoFloat(ar[ij,35]))<=10 then

begin

kol[ij]:=kol[ij]+1;

end;

for ij:=1 to p-1 do

If (ar[ij,35]<>'-') then

If Edit62.Text=ar[ij,35] then

begin

kol1[ij]:=kol1[ij]+1;

end;

end;

//статус производства

if (Edit66.Visible=true) then

for ij:=1 to p-1 do

If (ar[ij,36]<>'-') then

If Edit66.Text=ar[ij,36]then

begin

kol[ij]:=kol[ij]+1;

kol1[ij]:=kol1[ij]+1;

end;

for ij:=1 to p-1 do

skol:=kol[ij]+skol;

If skol=0 then Showmessage('В базе нет самолётов подходящих под Ваши параметры');

for ij:=1 to p-1 do

stringgrid4.Cells[ij,0]:=floattostr(kol[ij]);

93

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