Problem description

1. Define a struct named carType to store the following data about a car (pick the best data types):

  • Manufacturer (i.e. Toyota)
  • Make (i.e. Camry)
  • Model (i.e. LE)
  • Price (i.e. $20000.87)

2. Declare variables named myCar and yourCar from the carType. Show how to assign values to these variables. Make sure to display the values of the variables.

3. Define an array with 3 elements from the carType struct.

4. Write a function named getCar to read and store data into an array of carType. You can ask the user for the data inside this function.

5. Write a function named displayData that accepts an array of carType and the name of a file. Write the data to the file.

6. Use command line arguments to accept the name of the output file from the command line.

You should be able to run your code as the following:

./a.out cars.txt
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.