Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

enum in c++

#include <bits/stdc++.h>
using namespace std;
 
int main()
{
    // Defining enum Gender
    enum Gender { Male, Female };
 
    // Creating Gender type variable
    Gender gender = Male;
 
    switch (gender)
    {
    case Male:
        cout << "Gender is Male";
        break;
    case Female:
        cout << "Gender is Female";
        break;
    default:
        cout << "Value can be Male or Female";
    }
    return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #enum
ADD COMMENT
Topic
Name
3+3 =