/*********************************************************************
safearray.h
    "safe" array of strings
*********************************************************************/
#include <iostream>
#include <string>
using namespace std;
#include <process.h> //for the exit() function

const int maxsize = 100;

//class definition
class safearray {
    private:
        string array[maxsize];
    public:
        string& operator[](const int& pos) {
            if ((pos < 0) || (pos >= maxsize)) {
                cerr << endl << "Index out of bounds" << endl;
                exit(1);
            }
            return array[pos];
        }

        const string& operator[](const int& pos) const {
            if ((pos < 0) || (pos >= maxsize)) {
                cerr << endl << "Index out of bounds" << endl;
                exit(1);
            }
            return array[pos];
        }

};