### an Amateur programmer 2 part2

for( Generation = 1 ; Generation < Emperor ; Generation++ )
{
nowd = Generation % 2 ;
nowm = nowd + pow( -1 , nowd ) ;
i = Emperor - Generation ;
delete [] *MD[ nowd ] ;
MD[ nowd ] = new int *[first[ i ]] ;

//Design ......... fired function ...
for( c_Msisters = 0 ; c_Msisters < first[ i+1 ] ; c_Msisters++ )
{
cout << "\nWich column or row you want the matrix to be basted nesbat ?"
<< "\n( matrix number " << ( c_Msisters + 1 )
<< " from the former phase )\n" ;
cin >> hold ;
if( hold == 'i' )
race = 1 ;
else
race = 2 ;
cin >> hold ; // = ro migire
cin >> father ;

pluse = 0 ;
cout << "\nbast result : " ;
for( c_Dsisters = 0 ; c_Dsisters < first[i] ; c_Dsisters++ )
{
MD[ nowd ][ c_Msisters ] = new int [ second[i] ] ;

cout << "\nfine before colloge" ;
Collage( Queen , MD[ nowm ][ c_Msisters ] , MD[ nowd ][ c_Dsisters ] ,
c_Dsisters , father , 2*(i+1) , race ) ;

cout << "\ngood good after collage before Detprinter" ;
DetPrinter( i , MD[ nowd ][ c_Dsisters ][ 2*i + 1 ] ,
MD[ nowd ][ c_Dsisters ][ 2*i + 2 ] ,
MD[ nowd ][ c_Dsisters ] , Queen , pluse ) ;
cout << "\nok that's allright after Detprinter" ;
pluse = 1 ;
}//end for D
}//end for M
}//end for Generation

cout << "\n\nonly three steps are left to have the answer ...\n" ;
for( i = 0 ; i < first[2] - 1 ; i++ )
{
Daughters[i]=Determinant(Queen[ MD[ nowd ][i][0] ][ MD[ nowd ][i][2] ] ,
Queen[ MD[ nowd ][i][0] ][ MD[ nowd ][i][3] ] ,
Queen[ MD[ nowd ][i][1] ][ MD[ nowd ][i][2] ] ,
Queen[ MD[ nowd ][i][1] ][ MD[ nowd ][i][3] ] ) ;
cout << MD[ nowd ][i][5] << " * " << Daughters[i] << " + " ;
}//end for i

Daughters[i]=Determinant(Queen[ MD[ nowd ][i][0] ][ MD[ nowd ][i][2] ] ,
Queen[ MD[ nowd ][i][0] ][ MD[ nowd ][i][3] ] ,
Queen[ MD[ nowd ][i][1] ][ MD[ nowd ][i][2] ] ,
Queen[ MD[ nowd ][i][1] ][ MD[ nowd ][i][3] ] ) ;
cout << MD[ nowd ][i][5] << " * " << Daughters[i] ;

cout << "\n\ntwo steps ...\n" ;
for( i = 0 ; i < first[2] - 1 ; i++ )
{
Daughters[i] *= MD[ nowd ][i][5] ;
cout << Daughters[i] << " + " ;
}//end for i
Daughters[i] *= MD[ nowd ][i][5] ;
cout << Daughters[i] << "\n\nand there it is the answer : " ;
for( i = 0 ; i < first[2] ; i++ )
Daughters[i] ;

getch() ;
return 0 ;
}/*end main function */
//
//
//function has been canceled
/*void Desk( const int Emperor , /*const/ int **Queen/*[][Emperor]/ , const int first[] ,
const int second[] )
{
//char hold ;
int c , //counter
/* Mother[ 2*Emperor + 2 ] ,
DM9[ first[9] ][ second[9] ] ,
DM8[ first[8] ][ second[8] ] ,
DM7[ first[7] ][ second[7] ] ,
DM6[ first[6] ][ second[6] ] ,
DM5[ first[5] ][ second[5] ] ,
DM4[ first[4] ][ second[4] ] ,
DM3[ first[3] ][ second[3] ] ,
DM2[ first[2] ][ second[2] ] ,
*ptr[10] ; /
*Daughters ,
Generation ,//counter
//race ,//column ? or row ? to bast nesbat
//father , //the column or row to bast nesbat
**MD ,
**DM ,
***ptr[2] ,
i ,
antic ;

Daughters = new int[ first[2] ] ;
ptr[0] = &MD ;
ptr[1] = &DM ;
//ptr = { &MD , &DM } ;

/* ptr[10] = {/*Queen ,/Mother , DM9[0] , DM8[0] , DM7[0] , DM6[0] , DM5[0] ,
DM4[0] , DM3[0] , DM2[0] }, */

/*for( c = 0 ; c < Emperor ; c++ )
Mother[c] = Mother[ c+Emperor ] = c+1 ;

Mother[ c+1 ] = Mother[ c+2 ] = 1 ; */

/*cout << "\nWich column or row you want the matrix to be basted nesbat ?\n"
cin >> hold ;
if( hold == 'i' )
race = 0 ;
else
race = 1 ;
cin >> hold ; // = ro migire
cin >> father ; / //inkara ro dakhele khode tabee zir mikonam
//ManageErasing( Queen , ptr[ Emperor ] , Emperor , )
//CollageBoard( Queen ,

MD = new int*[1] ;
for( c = 0 ; c < Emperor ; c++ )
MD[0][c] = MD[0][ c+Emperor ] = c+1 ;
MD[0][ c+1 ] = MD[0][ c+2 ] = 1 ;

//for( Generation = Emperor ; Generation <= 3 ; Generation-- )
for( Generation = 1 ; Generation < Emperor ; Generation++ )
{
c = Generation % 2 ;
antic = c + pow( -1 , c ) ;
i = Emperor - Generation ;
*ptr[c] = new int *[first[ i ]] ;//[second[ i ]] ;
Design( second[ i ] , first[ i ] ,
*ptr[ antic ] , *ptr[ c ] , Emperor , Queen ) ;
delete [] *ptr[ antic ] ;

}//end for Generation

for( antic = 0 ; antic < first[2] ; c++ )
Daughters[c]=Determinant(Queen[ (*ptr[c])[antic][0] ][ (*ptr[c])[antic][2] ] ,
Queen[ (*ptr[c])[antic][0] ][ (*ptr[c])[antic][3] ] ,
Queen[ (*ptr[c])[antic][1] ][ (*ptr[c])[antic][2] ] ,
Queen[ (*ptr[c])[antic][1] ][ (*ptr[c])[antic][3] ] ) ;

}/*end function */
//
//function//
/*void Design( int const Prince , int const n_Mothers ,
//int Mothers[][ 2*Prince + 2 ] , int Daughters[][ 2*Prince ] ,
int **Mothers , int **Daughters ,
const int Emperor , int **Queen )
{
char hold ;

int c_Msisters ,
c_Dsisters ,
race ,
father ,
pluse ;

for( c_Msisters = 0 ; c_Msisters < n_Mothers ; c_Msisters++ )
{
cout << "\nWich column or row you want the matrix to be basted nesbat ?"
<< "\n( matrix number " << c_Msisters << " from the former phase )\n" ;
cin >> hold ;
if( hold == 'i' )
race = 1 ;
else
race = 2 ;
cin >> hold ; // = ro migire
cin >> father ;
//father *= race ;
/*if( race == 'i' )
iump = father ;
else
jump = 2*father ;
pluse = 0 ;
cout << "\nbast result : " ;
for( c_Dsisters = 0 ; c_Dsisters < Prince ; c_Dsisters++ )
{
Collage( Queen , Mothers[ c_Msisters ] , Daughters[ c_Dsisters ] ,
c_Dsisters , father , Prince*2 , race ) ;
DetPrinter( Prince-1 , Daughters[ c_Dsisters ][ 2*Prince - 2 ] ,
Daughters[ c_Dsisters ][ 2*Prince - 1 ] , Daughters[ c_Dsisters ] ,
Queen , pluse ) ;
/*if( c_dsisters < Prince-1 )
cout << " + " ;
pluse = 1 ;
}//end nested for
}//end principal for

}/*end function */

//to be continued
Topic archived. No new replies allowed.