Homework 3 -- Array access in C++

A word about this assignment

This assignment is a review of C++ arrays used in a database-like situation. Let's suppose you complete this assignment and receive a raw grade of home3-raw-grade and that your grade on Homework 1 was home1-grade. Then your grade for this homework is computed using the following formula:

In other words, if you successfully completed CSCI 343 Homework 1, you need not do this homework assignment.


Within your Computer Science home directory create a protected subdirectory for this assignment by typing the following commands:

Now copy some initial files for the assignment into this directory by typing the following commands:

The big picture

This assignment is almost exactly like the first homework assignment. The only difference is that the main routine will call your rangeSearch routine with an array rather than an open file.

Your routine rangeSearch must conform to the following C++ prototype:

Only the first argument has changed between the two assignments. The first argument is now an array containing all the records of the database. Your routine should return a non-zero value if a record with key k is found, in which case the record should also be copied into the buffer buff. If a matching record is not found, a zero value should be returned.

The array passed to your program is a memory-mapped copy of the database file used in the first assignment. Consequently, correct solutions to Homeworks 1 and 3 should return the same values.

Due dates and turning it in

At noon on Wednesday, 10 March, a script will be run to copy rsearch.cpp from your csci/343/home03 directory. This script will be run at noon for five consecutive days. Each day your rsearch.cpp is missing or fails to successfully solve the problem, 20% will be deducted from your grade for homework three.

Back to the CSCI 363 homework page
Back to the CSCI 363 home page