-
matrix
Hi, I'm newbie in C++. I found a code in assemblylineScduling using dynamic programming.
In part of the codes, I found,
Code:
for(i=0; i<numStations; i++) //numStation=5
{
for(j=0; j < numLines; j++) //numLines 2
{
for(k=0; k < numLines; k++)
{
if(j!=k && i!=numStations-1 )
{
fin >> transferCost[j][i][k];
}
else
{
transferCost[j][i][k]=0;
}
}
}
}
where,
fin, I believe is the .dat input file with the transfer costs as follows,
2 2
3 1
1 2
3 2
4 1
I wonder what is this, fin >> transferCost[j][i][k]; means.
If I'm not wrong, mat[2][3] is: 1 1 1
1 1 1
what will be transferCost[][][] outputs in the above statement? and how about
transferCost[j][i][k]=0;
thanks in advance!
-
Re: matrix
fin >> transferCost[j][i][k];
Read a value from the fin stream into the 3D array transferCost at position j,i,k.
So, if transferCost contains integers, that lines will read 1 integer and store it in the array at position j,i,k.