Visual C++ .NET/Statement/switch

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

Create a switch Statement

<source lang="csharp">

  1. include "stdafx.h"
  2. 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;

}

 </source>