Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!uoft02.utoledo.edu!desire.wright.edu!demon From: demon@desire.wright.edu Newsgroups: comp.lang.c++ Subject: C++ code won't compile: need help Message-ID: <1991Jan29.161631.2375@desire.wright.edu> Date: 29 Jan 91 21:16:30 GMT Organization: University Computing Services, Wright State University Lines: 38 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 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]; }