October 16th, 2011 09:34 AM
#1
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!
Last edited by Marc G; October 20th, 2011 at 02:28 AM .
Reason: Added code tags
October 20th, 2011 02:29 AM
#2
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.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width
Bookmarks