Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help on how to compare 2 input files.

Status
Not open for further replies.

mt9999

Technical User
Oct 16, 2002
1
0
0
US
i am doing on this project but i could not get it done n i am really lost. here is the problem: read input from a Products.txt file, which has the format of ProductId, ProductName, Cost, SalesPrice, Qoh, VendorName, and PurchaseDay. Another file called PriceUpdate.txt, your program should use this file to update the product pricing. As the result, your program will create a new file that has updated pricing information for all products; you can name this new file ProductsUpdate.txt. And all the error messages should be written on the other file called Errors.txt. the files Priceupdate.txt has only productId and Cost. I do not know how to use this file to compare it with the first one. I tried to use structure with array but i could not do it. I could read in the first file but do not know how to write a code to compare. Can any of you guys in here help me out? or give me some hints for how to solve this problem? thanks a lot!

here is a code for the first n second file that i wrote:
{
char read_in;
fin.get(read_in);
while(! fin.eof())
{
cout.put(read_in);
fin.get(read_in);
}
{
char read_in_second;
fin2.get(read_in_second);
while(! fin2.eof())
{
cout.put(read_in_second);
fin2.get(read_in_second);
}


 
You have to put the block starting with fin2.get... within
your first loop.
from read_in and read_in_second you'll have to extract the
values you want to compare.
hope this helps
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top