Create a switch Statement : switch « Statement « Visual C++ .NET






Create a switch Statement

 

#include "stdafx.h"
#using <mscorlib.dll>
using namespace System;
int main(void)
{
    int x = 2;
    switch (x)
    {
    case 1:
        Console::WriteLine("Case 1");
        break;
    case 5:
    case 6:
        Console::WriteLine("Case 5 or 6");
        break;
    default:
        Console::WriteLine("Default case");
    }

    return 0;
}

   
  








Related examples in the same category