Homework 5 - Chapters 7 - 10
Due Monday, November 20, 2006 at 5pm.
Name your files hw5_<problem>.cpp, such as hw5_1.cpp. Email all the cpp
files to my Helios account.
You can copy any of the sample input files to your current directory using
cp /usr/users/mdanfor/public_html/cs221-f06/<filename> .
This homework features two versions of a simple grade menu. The first version
uses 2D arrays and the second version uses structures. Each version is worth
10 points. Both versions use the same menu as follows:
Welcome to the CS221 Homework 5 Menu
===============================================
1. Enter student data from keyboard.
2. Enter student data from file.
3. Print score for one student.
4. Print score for all students.
0. Exit
===============================================
Enter selection:
Problems
- Use 2D arrays to implement the grade book menu. You will have one 2D
character array for names, where each row is a C-style string containing
the name of the student. You will also have one 2D interger array for quiz
scores, where each row is the scores for one student.
- Use structures to implement the grade book menu. You will have a 1D
array of structures. The structure will contain the name and quiz scores.
Extra Credit (10pts)
From the book, Programming Project 7.13, pp 442-443. Conway's "Game of Life".
This is a rather lengthy description, so I will not copy it here. If you do
not have a text book, there is a copy in the secretary's office that you can
borrow to photocopy the assignment. Additional resources:
Use a text file to contain the initial generation for the game. The text
file has the same format as the screen output. That is, it will contain 22
lines with each line having 80 characters. A space indicates an empty cell
and an asterick indicates an occupied cell. Try using some of the initial
configurations given in the above resources.
Sample input files follow:
I've also uploaded a working binary solution to the problem so you can see
how the game appears on these sample files. From within Helios, run the
following command: /usr/users/mdanfor/public_html/cs221-f06/gol
It
will prompt you for the number of generations (I'd suggest start low like 50
and only go higher for more complex patterns) and the filename. Try it out
on the above filenames to see it in action. It works best if your terminal
is set for 24 rows and 80 cols.