Difference between revisions of "CPP/Enum"

From ProgrammingExamples
< CPP
Jump to: navigation, search
(Created page with '==Enum.cpp== <source lang="cpp"> #include <iostream> enum PointType { GOOD, BAD, UNINFORMATIVE }; int main(int argc, char *argv[]) { PointType A = GOOD; if(A == GOOD) …')
(No difference)

Revision as of 08:11, 23 June 2010

Enum.cpp

#include <iostream>
 
enum PointType { GOOD, BAD, UNINFORMATIVE };
 
int main(int argc, char *argv[])
{
  PointType A = GOOD;
 
  if(A == GOOD)
  {
    std::cout << "good" << std::endl;
  }
  else
  {
    std::cout << "not good" << std::endl;
  }
 
  if(A == BAD)
  {
    std::cout << "not working" << std::endl;
  }
  else
  {
    std::cout << "working" << std::endl;
  }
 
  return 0;
}