topical media & game development

talk show tell print

basic-program-code-02-Ex2-14.c

? / basic-program-code-02-Ex2-14.c


  // Ex2_14.cpp : main project file.
  // Defining and using a C++/CLI enumeration.
  
  include <stdafx.h>
  
  using namespace System;
  
  // Define the enumeration at global scope
  enum class Suit{Clubs, Diamonds, Hearts, Spades};
  
  int main(array<System::String ^> ^args)
  {
      Suit suit = Suit::Clubs;
      int value = safe_cast<int>(suit);
      Console::WriteLine(L"Suit is {0} and the value is {1} ", suit, value);
      suit = Suit::Diamonds;
      value = safe_cast<int>(suit);
      Console::WriteLine(L"Suit is {0} and the value is {1} ", suit, value);
      suit = Suit::Hearts;
      value = safe_cast<int>(suit);
      Console::WriteLine(L"Suit is {0} and the value is {1} ", suit, value);
      suit = Suit::Spades;
      value = safe_cast<int>(suit);
      Console::WriteLine(L"Suit is {0} and the value is {1} ", suit, value);
      return 0;
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.