Help with a program about reordering inventory

I need help trying to figure out how to read in a [b]master inventory file [/b]that contains product ID number, short name with a maximum length of 20 characters, the cost of the product, a reorder level for the product and a reorder amount for the product. Then read in the inventory list that contains the product id and the amount in stock. then i need to compare the inventory lists amount in stock to the reorder level of the master inventory to see if anything new needs to be ordered. An example of both files will be provided below. im not asking for someone to write the code, im just asking if anyone can walk me through it.

Thank you in advance.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
105 small_widget 1.45 50 150 
205 med_widget 2.75 75 350 
305 large_widget 4.95 35 125 
104 small_gizmo 12.48 60 200 
204 med_gizmo 18.50 100 400 
304 large_gizmo 28.60 40 150 
108 small_thingy .78 100 300 
208 med_thingy 2.38 250 750 
308 large_thingy 5.25 75 250 
101 blue_stuff 35.25 15 50 
201 gold_stuff 35.25 15 50 
301 green_stuff 35.25 15 50 
401 red_stuff 35.25 15 50 
103 metal_gadget 56.98 15 45 
203 plastic_gadget 38.45 20 80


304 89
108 105
208 125
308 60
101 40
201 15
301 45
401 16
105 45
205 150
305 20
103 20
104 60
204 250
203 5

Are you comfortable with classes?
I'll give you a high level walkthrough:

First you would create a product class with a field for ID, name, etc. You also want to define a compare function based on product ID

Then, line by line, read from your master inventory file to create a product object and store that into a vector. Then use the built in sort to sort your vector.

For the inventory file, read in line by line again. For each line, find the object matching the ID and compare the reorder level of the object with the current amount.
Topic archived. No new replies allowed.