CS1411 - 160 - Programming Principles I, Spring 2005

Lab assignment 12

Motivation

This weeks you will practice file i/o

Mandatory work

Your TA will check that you have done the following things (you may leave once their done) :

Write a program that will ask the user to input Name (string) / number (int) pairs and save them to a file. In the output there should be one name/number per line.

Find the file (in Finder or Explorer). Check its contents.

Write another program (or extend the first program) to read in the data you have just written. Print it on screen while it is read.

Optional work

Reformat your data file and check if it still loads

Instead of reading it in and printing it directly to screen, try storing it (in two arrays, or an array of struct).

Try formatting the output more nicely.

How?

Please check the labs page on how to get started. There are instructions for visual studio (use version 6) and XCode

Please give the Macs a try. If you simply cannot work with them, go to PE 119, but let your TA know.

Help!

For help: ask your TA! He is here to help you!

If the instructions are unclear or you have any other questions, please email me