290: Find(offset,PartNumber);
291: return offset;
292: }
293:
294: Part * PartsCatalog::Get(int PartNumber)
295: {
296: int offset;
297: return (Find(offset, PartNumber));
298: }
299:
300: int main()
301: {
302: PartsCatalog pc;
303: Part * pPart = 0;
304: int PartNumber;
305: int value;
306: int choice = 99;
307:
308: while (choice != 0)
309: {
310: cout << “(0)Quit (1)Car (2)Plane: “;
311: cin >> choice;
312:
313: if (choice != 0)
314: {
315: cout << “New PartNumber?: “;
316: cin >> PartNumber;
317:
318: if (choice == 1)
319: {
320: cout << “Model Year?: “;
321: cin >> value;
322: pPart = new CarPart(value,PartNumber);
323: }
324: else
325: {
326: cout << “Engine Number?: “;
327: cin >> value;
328: pPart = new AirPlanePart(value,PartNumber);
329: }
330: pc.Insert(pPart);
331: }
332: }
333: pc.ShowAll();
334: return 0;
335: }
578 Day 16
LISTING16.7 continued