an Amateur programmer 2 part3

void Collage( int **root , int const resource[] , int result[] , int const remove ,
const int scrap , int const steps , int const status )
{
int signLegacy ,//mosbat ya manfi budane onsore lola
jump , iump ,
s , r ;

//if status is 2 scrap is jump
if( status == 2 ) //followed by else
{
jump = scrap + steps ;
iump = remove ;
}//end if
else
{
jump = remove + steps ;
iump = scrap ;
}//end else

/* for( s = 0 , r = 0 ; s < n_steps ; s++ , r++ )
{
if( s == iump || s == jump )
s++ ;

result[ r ] = resource[ s ] ;
}//end for */

for( s = 0 , r = 0 ; s < iump ; s++ , r++ )
result[ r ] = resource[ s ] ;
s++ ;
for( s , r ; s < jump ; s++ , r++ )
result[ r ] = resource[ s ] ;
s++ ;
for( s , r ; s < 2*steps ; s++ , r++ )
result[ r ] = resource[ s ] ;


//jump -= steps ;
//signLegacy = ( iump + jump ) % 2 ;
signLegacy = ( remove + scrap ) % 2 ;
signLegacy = pow( -1 , signLegacy ) ;
//result[ r+1 ] = signLegacy * root[ resource[iump] ][ resource[jump] ] ;
//result[ r+2 ] = resource[ s+2 ] * result[ r+1 ] ;
result[ r ] = signLegacy * root[ resource[iump] ][ resource[jump] ] ;
result[ r+1 ] = resource[ s+1 ] * result[ r ] ;


}/*end function */
//
//
//function//
void DetPrinter( const int setcomma , const int lolaPresent , const int lolasPrevious ,
const int jindex[] , int **Matrix , const int pluse )
{
int sizeSetw ,
i , j ;

/*cout << lolasPrevious << " * " << lolaPresent << " * det{ " ;
for( c = 0 ; c <
{
if( c % setcomma == 0 )
cout << "," ;

cout << Queen[ jindex[c] ][ jindex[c+setcomma] ] << " " *///not elegant

sizeSetw = Digitshomar( lolaPresent ) + Digitshomar( lolasPrevious ) + 10 ;

for( i = 0 ; i < setcomma-1 ; i++ )
{
if( i == setcomma/2 )
{
if( pluse )
cout << "\n + " ;
cout << lolasPrevious << " * " << lolaPresent << " * |" ;
}//end if vasate matric
else
cout << "\n" << setw( sizeSetw ) << "|" ;

for( j = setcomma ; j < 2*(setcomma-1) ; j++ )
{
cout << setw(4) << setiosflags( ios :: left )
<< Matrix[ jindex[i] ][ jindex [j]] ;
}//end for j
cout << Matrix[ jindex[i] ][ jindex[j+1]] << "|" ;
}//end for i
}

int Digitshomar( int integer )
{
int c ;

for( c = 0 ; integer ; c++ )
integer = integer/10 ;

return c ;
}

int Determinant( int a , int b , int c , int d )
{
return a*b-c*d ;
}

void Matkesh( int **Matrix , int jindex[] , int newline )
{
int j , i ;

for( i = 0 ; i < newline ; i++ )
{
if( i == 0 || i == newline-1 )
cout << "\n[" ;
else
cout << "\n|" ;
for( j = 0 ; j < newline-1 ; j++ )
{
cout << setw(4) << setiosflags( ios :: left )
<< Matrix[ jindex[i] ][ jindex[ j+newline ] ] ;
}//end for j //akolad for the sake of clarity
//j++;
cout << Matrix[ jindex[i] ][ jindex[ j+newline ] ] ;

if( i == 0 || i == newline-1 )
cout << "]" ;
else
cout << "|" ;
}//end for i
}/*end function */
//end Q4

thank anybody who answers me , I wish to be under the kindness of God .

Topic archived. No new replies allowed.