Homework 1 - Structures

Due: Tuesday, January 19, 2009 at 5:00pm

Coding Conventions

The following coding conventions should be used for all assignments.

Assignment

The purpose of this assignment is to create a structure called ProductInfo for a small inventory control system. You will also be using a dynamic array to track the collection of products in the inventory. You MUST use a dynamic array for this assignment. Any assignment that does not use new/delete will have points deducted.

The ProductInfo structure must have the following pieces of data:

You will have the following two void functions to manipulate ProductInfo objects: Your main function will do the following steps:
  1. Prompt the user for the number of products they wish to add to the inventory and read the response in.
  2. Validate that the integer given by the user is greater than 0. Points will be deducted if you do not validate the user's input.
  3. Dynamically allocate an array of ProductInfo objects using the integer given by the user.
  4. For each object in the ProductInfo array, call addProduct.
  5. For each object in the ProductInfo array, call showProduct.
  6. Deallocate the array.
Email your source code to me by the due date.