C++ code showing usage of switch construct