Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2005.10.23;
Скачать: CL | DM;

Вниз

С++ TO DELPHI (PASCAL)   Найти похожие ветки 

 
DroNIX   (2005-10-01 21:38) [0]

Что я сделал не так?
Вот исходник на СИ:


void easing ( unsigned long * P, unsigned long * S , int numb, int& numb_kon )
{
    P[numb] = P[numb_kon - 1];
    S[numb] = S[numb_kon - 1];
    if ( numb_kon > 1 )  numb_kon--;
}

int skleiv ( unsigned long * P, unsigned long * S, int i, int j, int& numb_kon )
{
   unsigned long c;
   if ( P[i] == P[j] ) {
c = S[i] ^ S[j];
if ( c ) {
    if ( ! ( c & (c - 1) ) ) {
  P[i] &= ~c;
  S[i] &= ~c;
  easing ( P, S, j, numb_kon );
  return 0;
    }
    else
 return 1;
}
// Две одинаковые конъюнкции
else  {
    easing ( P, S, j, numb_kon );
    return 1;
}
   }
   else
return 1;
}

int nep_skleiv ( unsigned long * P, unsigned long * S, int i, int j )
{
   unsigned long c;
   int d;
   if ( !( P[i] & ~P[j] ) && !( P[i] == P[j] ) ) {
 d = j;
   }
   else {
if ( !( ~P[i] & P[j] ) && !( P[i] == P[j] ) ) {
     d = i;
}
else
    return 1;
   }
   c = ( S[i] ^ S[j] ) & ( P[i] & P[j] );
   if ( ! ( c & ( c - 1 ) ) ) {
 P[d] &= ~c;
 S[d] &= ~c;
 return 0;
   }
   else
return 1;
}

int poglosh ( unsigned long * P, unsigned long * S, int i, int j, int& numb_kon )
{
   unsigned long c;
   if ( ! ( ~P[j] & P[i] ) ) {
c = P[i] & P[j];
if ( ! ( ( S[i] ^ S[j] ) & c ) ) {
    easing ( P, S, j, numb_kon );
    return 0;
}
else
    return 1;
   }
   else
return 1;
}

Вот так я сделал в делфи: Уже 2 недели немогу понять что тут не правильно.

procedure easing(numb: integer;  var numb_kon1: integer);
begin
 P[numb]:= P[numb_kon1-1];
 S[numb]:= S[numb_kon1-1];
Form1.P.Lines.Add(IntToStr(P[numb])+" cn="+IntToStr(cn));
Form1.S.Lines.Add(IntToStr(S[numb]));
inc(cn);
 if numb_kon1>1
 then
 dec(numb_kon1);
end;

function skleiv(i: integer;  j: integer;  var numb_kon: integer): integer;
var
cx: integer;
begin
 if P[i]=P[j] then
 begin
   cx:= S[i] xor S[j];
   if cx<>0 then
   begin
     if (cx and (cx-1)) = 0 then
     begin
       P[i]:= P[i] and not cx;
       S[i]:= S[i] and not cx;
       easing(j,numb_kon);
       begin
         result:= 0;
         exit;
       end;
     end
     else
     begin
       result:= 1;
       exit;
     end;
   end
   else
   begin
     easing(j,numb_kon);
     begin
       result:= 1;
       exit;
     end;
   end;
 end
 else
 begin
   result:= 1;
   exit;
 end;
end;

function nep_skleiv(i: integer;  j: integer): integer;
var
cx, d: integer;
begin
if ((P[I] and not P[j]) = 0) and (P[i] <> P[j])
 then
 begin
   d:= j;
 end
 else
 begin
 if ((not P[I] and P[j]) = 0) and (P[i] <> P[j])
   then
   begin
     d:= i;
   end
   else
   begin
     result:= 1;
     exit;
   end;
 end;
 cx:= (S[i] xor S[j]) and (P[i] and P[j]);

 if (cx and (cx-1))=0 then
 begin
   P[d]:= P[d] and ( not cx);
   S[d]:= S[d] and ( not cx);
   begin
     result:= 0;
     exit;
   end;
 end
 else
 begin
   result:= 1;
   exit;
 end;
end;

function poglosh(i: integer;  j: integer;  var numb_kon: integer): integer;
var
cx: integer;
begin
 if  (not P[j] and P[i])=0 then
 begin
   cx:= P[i] and P[j];
 if ( ( S[i] xor S[j] ) and cx) <> 0 then
   begin
     easing(j,numb_kon);
       result:= 0;
       exit;
   end
   else
   begin
     result:= 1;
     exit;
     
   end;
 end
 else
 begin
   result:= 1;
   exit;
   
 end;
end;


 
Кефир87 ©   (2005-10-01 22:50) [1]

Ну и кто это будет читать?! Ты хоть покажи где ошибка...


 
S@shka ©   (2005-10-01 22:57) [2]

Я честно посмотрел )))) - вскользь ))))


 
DroNIX   (2005-10-02 19:37) [3]

Скорей всего в функции nep_skleiv
Остальное врде правильно считает.



Страницы: 1 вся ветка

Текущий архив: 2005.10.23;
Скачать: CL | DM;

Наверх




Память: 0.48 MB
Время: 0.692 c
2-1127898066
Ольга
2005-09-28 13:01
2005.10.23
ComboBox.ItemIndex:=???


14-1127899345
Fenix
2005-09-28 13:22
2005.10.23
ТЕдит


1-1128071863
LordOfRock
2005-09-30 13:17
2005.10.23
Древовидная структура


14-1127992446
igor666
2005-09-29 15:14
2005.10.23
Подскажите плз. есть ли какой-нибудь компонент...


11-1109647517
hotes
2005-03-01 06:25
2005.10.23
Модуль Windows