[comp.lang.c++] C++ code won't compile: need help

demon@desire.wright.edu (01/30/91)

	Can any c++ expert give me some help with this code?  A friend who does
not have net access can not get it to compile.  My knowledge of C++ is not that
great...
	Thanx in advance

Brett
bkottmann@falcon.aamrl.wpafb.af.mil


#include <stream.h>

typedef enum{red, green, amber} traffic_light_color;
struct intersection {

	traffic_light_color  traffic_light;
  	int                  number_cars_queued;
	int                  cumulative_number_cars;

	friend ostream & operator << (ostream & s, intersection & light);
 };

ostream & operator << (ostream & s, intersection & light) {

   switch (light.traffic_light) {
	case red:	return (s << "red");
	case green:	return (s << "green");
	case amber:     return (s << "yellow");        
    }
 }

intersection network[50];

main()
{
  network[1].traffic_light = amber;
  cout << "The light at the 2nd intersection is " << network[1];
}