CS 153 Data Structures I
Programming Assignment #4

Due: 9/14/00

This programming assignment is designed to:

In order to meet these goals you must create a VC++ GUI that contains the following items: Plus the following additional window: The behavior of your program should be as follows: Hints for organizing your code:     Your OnBUTTONInsert might look like:
        void CProg3Dlg::OnBUTTONInsert()
        {
             UpdateData(TRUE);
             m_bag.Insert(m_Input);        //m_bag is a member variable of your ...Dlg class
                                                        //m_Input is the value from you Edit Box
             DisplayBag(m_bag);            // Discussed below
             UpdateData(FALSE);
        }

    Add a function to ...Dlg named DisplayBag() which might look like the following.  Notice that we are doing something a little 'bad' here.  The DisplayBag function is a member of the ...Dlg class, but we have it accessing the PRIVATE data (m_Data and m_CurSize) of a CBag object.  This is normally not a very good idea.  There are ways to avoid it.  You will study some of those ways soon.  For now, if you tell CBag that he/she has a
    friend class CProg4Dlg;
this will give a member function in the ...Dlg class full access rights to the private data of a CBag object Setting up the ListBox
  1. Drag a ListBox to your dialog window
  2. Use properties to Name it and TURN OFF THE SORTED OPTION
  3. Use the class wizard to assign a member variable name (m_OutputListing) to it like you did with the edit box, but the category must be CONTROL
  4. The DisplayBag function above shows you how to 'put stuff into the ListBox'