Comparing a struct array...
I'm writing a program that reads some files. The first file contains a list of data for books, and the second file contains information for markets from where the books are bought. The first file has the information for the market that the particular book was purchased...
The whole purpose for is to sort the book list by market, which I had no trouble doing. It goes something like this:
Code:
for (c = 1; c < MARKETS; c++)
{
for (i = 1; i < BOOK_IN_LIST; i++)
{
if (bArray[i].market == mArray[mkt].market)
{
input_to_file << bArray[i].item_name << endl;
}
}
mkt = mkt + 1
So it reads the nth market and checks the name against every market from the book data file, and inputs it to a file in sorted order with appropriate headers/footers.
The point where I'm drawing a blank is that some of the books do not have a market associated with it, or contain invalid text. If these markets are not in the book source/market file then I need to group them all together and list them as being invalid and needing to be fixed.
Any Ideas? I'm just suffering from (novice) programmer's block at the moment... haha.