Getting More Data from a File

Using Notepad or the text editor of your choice, create a text file containing five names and five ages. Save this file in your home directory.

Make a record to store information about a person. It should contain fields for:

Create an array of type Person with five slots.

Ask the user for the name of a file to open, and open that file and read in five names and ages from the file.

Display the contents of the array using a loop.

Which file to open: nameage.txt
Reading data from nameage.txt

Steve_Jobs is 50
James_Brown is 71
Britney_Spears is 23
Michael_Jackson is 46
Stanley_Kubrick is 76


©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License