CS 153 Data Structures I
Programming Assignment #4

Due: 9/13/01

This programming assignment is designed to reinforce your ability to:

NOTE ON THE USE OF PREVIOUS FILES - Don't

You will probably want to use much of the code that you developed for assignment #3. To do that, follow these suggestions

  1. Create your new project 4
  2. Copy/paste the .h and .cpp files from assignment 3 into your new project 4 directory
  3. From the 'file' view, right click on the ProjectFiles entry and select 'Add file to project'
  4. Modify the copied files to meet the new specifications

In order to meet these goals you will keep the user interface from Assignment #3 with the exception of changing the INPUT edit box to type CString

The behavior of your program should be as follows:

Hints for CBag:Insert(CString arg);

  1. declare m_data to be an array of 10 NTS locations/addresses/pointers
  2. find the length of arg
  3. allocate a dynamic null terminated string (NTS) of appropriate length
  4. strcpy the content of arg into the NTS
  5. store the location/address/pointer of the NTS into the appropriate m_data[i]

Hints for CBag::Remove(CString arg);

  1. use strcmp to compare each of the NTSs in MyBag to arg
  2. if you find one that is equal (i.e., it's location is store in m_data[i])
  3. move the locations around just like you did with the integers last week