Friday, December 4, 2020

Generating and presenting a matrix in an algorithm

 for(i=0;i<qF;i++)

{

G[i]=[];

var n = 0;

for(j=0;j<qE;j++){

if(D[i]==Ae[j]){

G[i][n]=A[j];

n++;

}

}

}

document.write("nome do financiado    CPF    bairro    tamanho    valor    <br>");

for(i=0;i<qF;i++)

{

document.write(G[i]);

document.write("<br>");

}

Look that part of code of my algorithm, that part is a part that generate a matrix of array, and is that I have the persons that got a loan to build a home and by the district the person will construct I want to know the engineer that works in the same neighborhood, but is that if are more than one I want the all them listed, so what I would do lets give numbers to make easier the explanation; if I have 12 clients(qF), I have to look for each one of the 12, and if I have 6 engineers(qE), I have to look 12 times for each client each one of the 6 engineers, so I gonna se 12 times all the 6 engineers, G[] was a array that I create to place the name of the engineers but how for that search I gonna have more than one I make that array became a matrix so G[i] = []; also I have to create another var that would be the n to create the index of the second slot of the matrix, the first slot will went to 0-11 in our exemple and the n would be changed every time that one engineer be of the same neighboorhood of the client, and how do you present the information only for that client: Is that the client name I put in a array that is the B[], so I put the B[i], the array of the array that is a matrix but i put G[i] and the G[i] that isn't only a position but also a matrix will present all the the engineers storage that is G[i][0],G[i][1],G[i][2],G[i][3],G[i][4],G[i][5]. Rute Bezerra de Menezes Gondim
Ps.: The Ae[] is the neighborhood of the engineer that will compare and once be the same would give the names of the engineers that are in the A[]