Last edited on
 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 //********************************************************************* // FUNCTION: DisplayResults // DESCRIPTION: function displays results of stored data on console // INPUT: // Parameters: oddHead, evenHead // File: none // OUTPUT: // Return Val: none // Parameters: oddHead, evenHead // File: none // CALLS TO: none //********************************************************************** void DisplayResults (ListNode* oddHead, ListNode* evenHead) { int oddCounter = 0; // counter for odd list int evenCounter = 0; // counter for even list cout << endl; cout << "Lists created using input file listnums.txt" << endl << endl; // determine how many records are in odd list for (ListNode* iter = oddHead; iter != NULL; iter = iter -> Next) { oddCounter++; } // output quantity cout << oddCounter << " integers inserted into Odd list: " << endl; // output integers stored in odd list for (ListNode* iter = oddHead; iter != NULL; iter = iter -> Next) { cout << iter -> Num << " "; } cout << endl << endl; // determine number of integers stored in even list for (ListNode* iter = evenHead; iter != NULL; iter = iter -> Next) { evenCounter++; } // output quantity cout << evenCounter << " integers inserted into Even list: " << endl; // output numbers stored in even list for (ListNode* iter = evenHead; iter != NULL; iter = iter -> Next) { cout << iter -> Num << " "; } cout << endl << endl; cout << "Search results for input file findthem.txt: " << endl << endl; }// end DisplayResults

Can someone help me figure out why my program is not working correctly? I think it has something to do with the files that I am trying to read in as command line arguments.
There should be two files "listnums.txt" and "findthem.txt" both that look like this:
findthem.txt is
647 292 34 234 54 92
23 234 98 2 348 752 39 4 87 501 92 385
12
23 4 523 46 457 7 65 43
2 398 47 502 98 734 58 12 734 5

listnums.txt is
34 123 23 94 217 99 230 984 750 9
10 312 80 9 734 91 872 3 98 741
32
456 4 23
234 52 3 467 65 232

I am supposed to run the program with these two parameters, validate that the correct number of files are passed, that the files open, and then run the program if so...when i run the program...my display shows up, but the numbers are all 0 as if it isn't reading the data in from the files.

Also, if anyone gets super excited and wants to help with an additional problem...my display (when it does work) is outputting identical lines..like copies of a line that has already been output...as if my for loop is incorrect.

All help is greatly greatly appreciated!
Topic archived. No new replies allowed.