// string.hpp     ** Super String **
//              **  Finally a string type for 'C++'!  **


#if !defined _string_hpp
#define _string_hpp

#include <iostream.h>
#include <string.h>
#include <stdlib.h>

class string
{
     struct srep
     {
       char *s;
       int n;
       srep() {n = 1;}
     };
     srep *p;
  public:
    string(const char *);    	// string x = "abc"
    string();
    string(const string &);     // string x = string ...
    string& operator=(const char *);
    string& operator=(const string &);
    ~string();
    char& operator[](int i);
	 operator double(){return atof(p->s);}
    int length(){return strlen(p->s);}
    friend ostream& operator<<(ostream&, const string&);
    friend istream& operator>>(istream&, string&);

    friend int operator==(const string &x, const char *s)
	{ return strcmp(x.p->s, s) == 0; }

    friend int operator==(const string &x, const string &y)
	{ return strcmp(x.p->s, y.p->s) == 0; }

    friend int operator!=(const string &x, const char *s)
	{ return strcmp(x.p->s, s) != 0; }

    friend int operator!=(const string &x, const string &y)
	{ return strcmp(x.p->s, y.p->s) != 0; }

	 friend int operator<(const string &x, const char *s)
	{ return strcmp(x.p->s, s) < 0; }

    friend int operator<(const string &x, const string &y)
	{ return strcmp(x.p->s, y.p->s) < 0; }

};


void error( const char* p);

#endif


