#include <iostream>
using namespace std;
int main()
{
enum TrafficLight
{
GREEN,
YELLOW,
RED
};
TrafficLight trafficlight1 = GREEN;
// Checking some stuff
if (trafficlight1 == TrafficLight::GREEN)
cout << "Traffic light is green!" << endl;
if (trafficlight1 == TrafficLight::YELLOW)
cout << "Traffic light is yellow!" << endl;
if (trafficlight1 == TrafficLight::RED)
cout << "Traffic light is red! Hold your horses!" << endl;
// Add prefixes to the enum names so that they are unique and no naming clashes
enum TrainLight
{
XGREEN,
XYELLOW,
XRED
};
TrainLight trainlight1 = XGREEN;
// Checking some stuff
if (trainlight1 == TrainLight::XGREEN)
cout << "Train light is green!" << endl;
if (trainlight1 == TrainLight::XYELLOW)
cout << "Train light is yellow!" << endl;
if (trainlight1 == TrainLight::XRED)
cout << "Train light is red! Hold your horses!" << endl;
return 0;
}