Dynamic memory allocation
Hello all. I am working on a project for a college level C++ course, and have run into a big snag. Here is the text of the assignment:
1. For this assignment, you will be creating a car search engine.
2. Your program should begin by reading a file that has the following record format
make model year price mileage
3. The name of the input file will be data1. There will be one record per line. There is no limit to the number of records. You MUST use dynamic memory allocation.
4. Your program should read in the file and store the records using a structure.
5. It should then prompt the user for search parameters
Please enter the search criteria:Make:Model:Year from:Year to:Price from:Price to:Mileage from:Mileage to:
6. Your program should search all the records based on the above criteria and list the results.
7. If the user puts in ANY for the make and model search for all makes and models. The range of years in the car information input file will be from 1984 to 2005. The user can search within this range of years. The maximum price in the car information input file will be 500,000. The maximum mileage in the car information input file will be 200,000.
I am having troubles with parameter number 3. Specifically, I'm not sure how to go about using dynamic memory allocation with a an array of a structure type. I know how to use DMA with a normal array, but when I try inputting the data from the structure array, I keep getting a compile error. Does anyone have any idea how to go about this? I would really appreciate any help.
Thanks.