The assignement is specific, but I think the problem is very general. I will really appreciate it if anyone can help me. I have uploaded the files to: http://sites.google.com/site/allenlosite/Home/lab1final.zip?attredirects=0
I have an assignment that reads lines of code and writes them into classes. The rules of the assignment are very strict and none of the files other than the Groceryapp.cpp, Get class in both Produce.cpp and Grocery.cpp can be edited. It also uses an I/O manager class file that uses pretty much ifstream and ofstream in a little more complex form. Not too hard, but here comes the problem.
While Grocery.cpp and Produce.cpp (and their headers) are almost identical, Produce uses Grocery's data members and functions through friend function( I think). I have 2 dynamic arrays, one for each type (G for Grocery classes, P for Produce classes). Grocery's datamembers are name, markup, and cost. Produce has those 3 plus 1 more, which is weight. Now, the input procedure is to put them in their respective arrays. Produce will use Grocery's "Get" function to read in the members, plus also add weight. My problem is when I enter them in, the second instance of produce will cause the program to crash. Grocery will not crash at all, it receives all the instances correctly. You will see me mark the problem areas with an asterick in the program.
Please, if you need clarification, let me know. I am so stumped and I have not gotten any help from my professor. Thank you.