SortedList01
Home ] Up ]

 

//sortedList01.cpp
//date: 09/09/2002
//author: AOU


#include<iostream.h>
#include<math.h>
#include<stdlib.h>
#include<time.h>


const int ARRAY_SIZE = 10;
const int UNDEFINED  = -9999;


class CSortedList
  {
  private:
    int array[ARRAY_SIZE];
    int count;
    int min;
    int max;
  public:
    CSortedList(void)
      {
      count = 0;
      min = UNDEFINED;
      max = UNDEFINED;
      }; 

    CSortedList(char ch)
      {
      count = 2;
      array[0] = 23;
      array[1] = 31;
      min = array[0];
      max = array[count-1];
      };

    void display(void)
      {
      cout << "SortedList(" << count << ")= ";
      for (int i=0; i<count; i++)
        cout << array[i] << ' ';

      cout << endl;
      };
    bool add(int x);      //myList.add(12);
  };

void main(void)
  {
    {
    CSortedList myList;
    myList.display();
    }

    {
    CSortedList myList('r');
    myList.display();
    }
  }