[Solved] CSCI804 Lab1-Functions and File I/O

$25

File Name: CSCI804_Lab1-Functions_and_File_I/O.zip
File Size: 329.7 KB

SKU: [Solved] CSCI804 Lab1-Functions and File I/O Category: Tag:
5/5 - (1 vote)

Task: Functions and File I/O (1.0)

Define a structure Pet consist data fields: status (lost or found), pet type, gender, breeds, age of year, age of month, colour, chip number, location, contact phone number in a file pet.h.

Define functions prototypes and other necessary definitions in the file pet.h.

The data fields types are decided by you.

Implement a function countRecords(char *) in a file pet.cpp that can return how many records of pets in a given text file. Implement a function loadRecords(char *, Pet *, int) load the pet records in a dynamic Pet array from the given text file. Implement a function printRecords(Pet *, int) print out all the pet records.

The example file pets.dat of pet records can be downloaded from the site of the lab task.

Each record stored in one line, different data fields separated by commas except the last field. There might be some empty lines in a given text file. The empty lines cannot be count as the records.

Implement driver program in the main function in pet.cpp to get the input text file name from a user, print out number of pet records that stored in the file, load pet records and print out all the data that loaded.

Dont forget to delete the dynamic pet record array before the program finished.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CSCI804 Lab1-Functions and File I/O
$25