dblinkl.cpp
Upload User: dq031136
Upload Date: 2022-08-08
Package Size: 802k
Code Size: 1k
Development Platform:

C++ Builder

  1. #include <iostream.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. class list_object 
  5. {
  6.  public:
  7.    char info;
  8.    list_object *next;
  9.    list_object *previous;
  10.    list_object(void) {
  11.       info = 0;
  12.       next = NULL;
  13.       previous = NULL;
  14.     }
  15.    list_object *getnext(void) {return next;}
  16.    list_object *getprevious(void) {return previous;}
  17.    void getinfo(char &c) { c = info;}
  18.    void change(char c) {info = c;}
  19.    friend ostream &operator<<(ostream &stream, list_object o)
  20.     {
  21.       stream << o.info << endl;
  22.       return stream;
  23.     }
  24.    friend ostream &operator<<(ostream &stream, list_object *o)
  25.     {
  26.       stream << o->info << endl;
  27.       return stream;
  28.     }
  29.    friend istream &operator>>(istream &stream, list_object &o)
  30.     {
  31.       cout << "Enter information: " << endl;
  32.       stream >> o.info;
  33.       return stream;
  34.     }
  35.  };