#include ; #include ; #include ; #include ; const int len = 5; typedef bool TBool[len][len]; typedef float TFloat[len][len]; typedef char* TChar[len][len]; FILE *out; AnsiString s; TChar MAdd,img1,img2,img3,m_town; bool fl, b_exit; TBool b_img1,b_img2,b_img3,m_graf,m_bmat,m_bmat_exp,m_napr,m_graf_exp; TFloat Mex,Ak,Mat,Mat1,Mat2,Mat_Res_1,Mat_Res_2,Mat_Res_M; int n,i, j, x, y, kolich; float f_sum, f_summa, f_min,MA[len], AM[len]; //----------------------------------------------------------------------------- void Transposition (float MA0, float MA1, float MA2, float MA3,float MA4, float AM0, float AM1, float AM2, float AM3, float AM4, int n_ ) { MA[0]=MA0; MA[1]=MA1; MA[2]=MA2; MA[3]=MA3; MA[4]=MA4; AM[0]=AM0; AM[1]=AM1; AM[2]=AM2; AM[3]=AM3; AM[4]=AM4; n = n_; } //----------------------------------------------------------------------------- void Print_Float_Matrix(float Matrix[len][len],char* str) { fprintf(out,"\n"); fprintf(out,str); fprintf(out,"\n"); for (int i=0; i to continue\n"); // getch(); } //----------------------------------------------------------------------------- void Print_Char_Matrix(TChar Matrix,char* str) { fprintf(out,"\n"); fprintf(out,str); fprintf(out,"\n"); for (int i=0; i to continue\n"); } //----------------------------------------------------------------------------- bool Compare_Float_Matrix(TFloat First,TFloat Second,TFloat Res, TChar Town_Res) { for (int i=0; i*Second[i,j]) { *Res[i,j] = *Second[i,j]; *Town_Res[i,j] = "m"; } else { *Res[i,j] = *First[i,j]; *Town_Res[i,j] = "c"; } } //----------------------------------------------------------------------------- bool Compare_Float_Matrix_X(TFloat First,TFloat Second,TFloat Res, TChar Town_Res) { for (int i=0; i*Second[i,j]) { *Res[i,j] = *Second[i,j]; *Town_Res[i,j] = "u"; } } //----------------------------------------------------------------------------- bool Copy_Char_Matrix(TChar From, TChar To) { for (int i=0; i to continue\n"); // getch(); } //----------------------------------------------------------------------------- void Calculate(int town ) { for (i=0; iMat[i][j])){f_min=Mat[i][j]; x=i; y=j;} for (int k=0; kMat[i][j])) {f_min=Mat[i][j]; x=i; y=j;} for (int k=0; kf_sum)) { f_summa=f_sum; for (i=0; i Akapulko\n"); Transposition( 6, 7.5, 11.5, 19, 0.5, 5.5, 9, 15, 18.5, 0, 5); //Mexico2Acapulko Calculate(1); Transposition( 6, 10, 13, 15, 19, 10, 15, 17, 22, 0, 5); //Acapulko2SantaLucia Calculate(2); Add_Float_Matrix(Mat_Res_1,Mat2,Mex); Add_Float_Matrix(Mat_Res_2,Mat2,Ak); Compare_Float_Matrix(Mat_Res_1,Mat,Mat_Res_M,m_town); Compare_Float_Matrix_X(Mat_Res_M,Mat_Res_2,Mat_Res_M,m_town); Print_Char_Matrix(m_town,"Result Matrix!\n"); } //----------------------------------------------------------------------------- void Mexico_2_SantaLucia() { fprintf(out,"\nMexico <-> Santa Lucia\n"); Transposition( 6, 7.5, 11.5, 19, 0.5, 10, 15, 17, 22, 0, 5); //Maxico2SantaLucia Calculate(1); Transposition( 6, 7.5, 11.5, 19, 0.5, 5.5, 9, 15, 18.5, 0, 5); //SantaLucia2Acapulko Calculate(3); Add_Float_Matrix(Mat_Res_1,Mat2,Mex); Add_Float_Matrix(Mat_Res_2,Mat2,Ak); Compare_Float_Matrix(Mat_Res_1,Mat,Mat_Res_M,m_town); Compare_Float_Matrix_X(Mat_Res_M,Mat_Res_2,Mat_Res_M,m_town); Print_Char_Matrix(m_town,"Result Matrix!\n"); } //----------------------------------------------------------------------------- void Akapulko_2_SantaLucia() { fprintf(out,"\nAkapulko <-> Santa Lucia\n"); Transposition( 6, 10, 13, 15, 19, 10, 15, 17, 22, 0, 5); //Akapulko2SantaLucia Calculate(2); Transposition( 6, 7.5, 11.5, 19, 0.5, 5.5, 9, 15, 18.5, 0, 5); //Mexico2Acapulko Calculate(3); Add_Float_Matrix(Mat_Res_1,Mat2,Mex); Add_Float_Matrix(Mat_Res_2,Mat2,Ak); Compare_Float_Matrix(Mat_Res_1,Mat,Mat_Res_M,m_town); Compare_Float_Matrix_X(Mat_Res_M,Mat_Res_2,Mat_Res_M,m_town); Print_Char_Matrix(m_town,"Result Matrix!\n"); } //----------------------------------------------------------------------------- bool Compare_Bool_Matrix(TBool* First,TBool* Second,TChar* First2,TChar* Second2) { for (int i=0; i