so I have to create a code where I'm reading from two files, inventory and order. I have compare the order and get the number of items were fulfilled and the total amount. This program below satisfies all that's needed however, I have to use eof() and I don't know how. The lines before this part of the program just simply reads the files and imports the information of the file to instream1 and instream2 which are internal names for the files. Thank you so much in advance.
for(int i=0;i<ord;i++){
for(int j=0;j<inv;j++){
if(prod_ord[i] == prod_code[j])
{
if(order[i] <= units[j])
{
fullfill[i]= order[i];
amt_billed[i] = fullfill[i] * unitprice[j];
}
else
{
fullfill[i]= units[j];
amt_billed[i] = fullfill[i] * unitprice[j];
}
}
else
{
cout<< "Order invalid."<<endl;
}
}
}
float total_due = 0;
cout<< "Order#: order0923\nSalesman: full name\n \t Fullfilled \t Amt Billed" <<endl;
for(int i= 0;i<ord;i++)
{
cout<< prod_ord[i]<<" \t"<<fullfill[i]<<" \t"<<amt_billed[i]<<endl;
total_due += amt_billed[i];
}
cout<<"Total Due: $"<<total_due<<endl;