CPP/Switch

From ProgrammingExamples
< CPP
Revision as of 09:16, 23 June 2010 by Daviddoria (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Switch.cpp

#include <iostream>
 
 
using namespace std;
 
int main(int argc, char *argv[])
{
  int test = 1;
  switch ( test ) 
  {
  cout << "before cases" << endl;
  case 1 : 
    cout << 1 << endl;
    break;
  case 2 : 
    cout << 2 << endl;
    break;
  default : 
    cout << "default" << endl;
 
  }
 
  return 0;
}