an Amateur programmer 2 part1

Q4)
we haven't been learned how to use dynamic array but I've read about it on the net and tried to use that for a program in which you want to calculate the determinant of an n*n matrix , but I don't know why the thread is stoped in the middle of the process , the output I had was so wired , I just did'nt know what to do ,
and THERE ARE TWO THINGS THAT I SHOULD EXPLAIN :
first : I haven't erased the parts that I've canceled , you can skip reading them .
second : there are some non-English words or phrases but most of the program is in English
third : I was bound tow cancel some functions becuz of **array but I don't exactly know why

//prototypes :
//int eliminate( void *ptr_matrix , int martabeOFresult , int omitRow ,
//int omitColumn )
//det[6]( //mikhastam arayeii az tabe tarif konam vali baiide beshe
/* det3//I wanted to declare an array of functions but I don't think it's
//pragmatic
det4, det5 */
//Desk is a func to manage the process :
void //Desk( const int , int **/*[][]*/ ,
//const int [] , const int [] ) ,
//Design( int const , int const , int ** , int ** , const int , int ** ) ,

//colloge function gives the pricipal matrix with all of its elements ,
//an array that contains the number of the rows and the columns and the joint //element of itself and the joint element of itself multiplied by the joint //elements of former phases ,
//and a new array that should be filled in this function ,
//and the row and the column that should be removed in this phase
Collage( /*const*/ int ** , int const [] , int [] , int const ,
int const , int const , int const ) ,

//prints the the determinant form of matrix using the character |
DetPrinter( const int , const int , const int , const int[] , /*const*/ int** , const int ) ,

//prints a matrix using [ at the left top and left bottom , ] at the right top //and the right bottom , | for middle parts
Matkesh( int ** , int[] , int ) ;

//counts the number of the digits of an integer number
int Digitshomar( int ) ,

//calculates a*b-c*d
Determinant( int , int , int , int ) ;

int main()
{
char hold ;

int remove_row , remove_column ,
**sample/*[3][3]*/ , //multiplication of joints
jindexSample[] = { 0 , 1 , 2 , 0 , 1 , 2 , 1 , 1 } ,
//row //column //present joint

eliminatedSample[2*2+2] ,
Emperor ,//emperor is n for an n*n matrix
**Queen ,//the matrix that user inputs
i , j ,
*first , *second ,
c , //antic ,
nowd , nowm ,
*Daughters ,//an array of determinant of 2*2 matrices multiplied by joint //elements
Generation ,//counter
//**MD , **DM , ***ptr[2] ,
**MD[2] ,
c_Msisters , c_Dsisters ,
race ,
father ,
pluse ,
answer = 0 ;

for( i = 0 ; i < 3 ; i++ )
for( j = 0 ; j < 3 ; j++ )
sample[i][j] = 3*i + j + 1 ;

cout << "\nsuppose that a 3*3 matrix is defined as :\n"
<< "\n [ 1 2 3 ]"
<< "\n | 4 5 6 |"
<< "\n [ 7 8 9 ]"
<< "\n\nchoose a row and a column of it ( enter numbers between 0 and 2 )"
<< "\nrow = " ;
cin >> remove_row ;
cout << "column = " ;
cin >> remove_column ;
Collage( sample , jindexSample , eliminatedSample ,
remove_row , remove_column , 3 , 2 ) ;
cout << "\nafter droping row " << remove_row << " and column "
<< remove_column << " your matrix will be :\n" ;
Matkesh( sample , eliminatedSample , 2 ) ;
cout << "\nand the element[" << remove_row << "][" << remove_column << "] * "
<< "(-1)^( " << remove_row << "+" << remove_column << " ) = "
<< eliminatedSample[4] ;

cout << "\n\nBy these tools , this program is able to calculate the "
<< "determinant of any matrix ."
<< "\nin every step , for every outcome matrix of the recent phase"
//I couldn't translate it well
//but bast the matrix nesbat
//means that you want to drop
//that column or row besides
//another row/column which is
//varied in every step
<< ", you can choose a\nrow or column to bast the matrix nesbat , "
<< "and the result of bast will be shown\nevery element will be set in a "
<< "4 width field , so your figures should have up to 4 digits , besides"
<< " multiplication of \"n\" arbitrary elements should have up to\n"
<< "13 digits to have a nice output ( \"n\" is the martabe of your "
<< "matrix )\n" ;

cout << "wich number do you like for martabe ? " ;
cin >> Emperor ;
Queen = new int*[ Emperor ] ;
for( i = 0 ; i < Emperor ; i++ )
Queen[i] = new int[ Emperor ] ;
cout << "enter your matrix :\n" ;
for( i = 0 ; i < Emperor ; i++ )
{
if( i == Emperor/2 )
cout << "Matrix = " ;
else
cout << setw(9) << ' ' ;

for( j = 0 ; j < Emperor ; j++ )
{
cin >> Queen[i][j] ;
}//end for j
}//end for i
////sakhtane 2 araye first tedade martica dar har marhale second tedade onasore
//////////matricaye un marhale :
first = new int[ Emperor+1 ] ;
second = new int[Emperor] ;

first[ Emperor-1 ] = Emperor ;
first[ Emperor ] = 1 ;
second[ Emperor-1 ] = 2*( Emperor-1 ) + 2 ;
for( i = Emperor-2 ; i >= 2 ; i-- )
{
first[i] = ( i+1 )*first[ i+1 ] ;
second[i] = second[ i+1 ] - 2 ;
}//end for meqdardehibe ferst o second
first[0] = first[1] = second[0] = second[1] = 0 ;
for( i = 0 ; i < Emperor ; i++ )
cout << " f" << i << " = " << first[i]
<< " s" << i << " = " << second[i] ;

//Desk ...... fired function ...

Daughters = new int[ first[2] ] ;

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

for( c = 0 ; c < Emperor ; c++ )
MD[0][0][c] = MD[0][0][ c+Emperor ] = c ;
MD[0][0][ c+Emperor ] = MD[0][0][ c+1+Emperor ] = 1 ;

MD[1] = new int*[1] ;
MD[1][0] = new int[1] ;

//to be continued

closed account (o3hC5Di1)
Hi there,

Welcome to the forums :)

When you have a very long code segment it's generally encouraged to use a site like http://pastebin.com and share the link with us. If you do want to place it only here, wrap the code in code tags to make it more readable: [code] code here [/code].

What do you mean by "the thread is stopped in the middle of the process?" do you mean that the program exits during execution? If so, at which point does it exit and with which error message?

If you could take these into consideration that would greatly help us to help you.

All the best,
NwN
Also, if there is a need for multiple posts on the same topic, post them all as replies to the one and only original thread. That reduces wasted time and effort for everybody. This is intended to be helpful advice, not a criticism.
thank you for answering , I showed my programs to a friend and she helped me solving them .

what a good advise chervil , I will do this if needed .
Topic archived. No new replies allowed.