Sunday, August 2, 2009

Does anyone know how to write the prigram for this it will C++?

7. File Reading 1 (Points: 30)


1This question has a bonus part (c) worth 10 points.


Consider an input file "data.dat" of the following format (one string and one int number). The data is meant to represent a person and his/her age.


Bob 20


Joe 30


Mary 10


.....





a) (10 points) Determine a data type that is suitable to hold this information in memory. Select a data type that does not require any knowledge about the number of lines in the file. You might want to create a base type (a class) to store the name and the age and a sequential container type (a vector) whose elements are of the type of this class.








b) (20 points) Write a complete program that handles the reading of this file. Structure the program so that a main function defines the necessary data and data types.


The actual reading is done by a function that takes the data structure as a parameter that will be changed in the function. The function opens the file, reads its content and stores the read data in e

Does anyone know how to write the prigram for this it will C++?
Yes, I know how to write the program for this.

pear

No comments:

Post a Comment