can any one help interipre this to a code. I'm not able to figure out this code below:

Read a type
If that type's not 0
Read the number of pounds
Repeat the steps until the type == 0

for (int n=0;n<buyer.type;n++)
	{ 
		fin >>buyer.type;
		if (buyer.type !=0)
		{fin>>buyer.pound;
		fout<<buyer.type<<' '<<buyer.pound<<' ';}
	}

Since you don't have any information beforehand telling you how many iterations the loop will go, a for loop is not a good choice here. As it's some condition that arises during the run, a while loop is the better choice, or even better, a do...while.

do
{
    //read buyer type
    //test if not 0
       //read & write the pounds
}while ( /* buyer type is not 0 */ };

Val