- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Enumerated Types or Enums in C++
In this tutorial, we will be discussing a program to understand Enumerated types or Enums in C++.
Enumerated types are user-defined data types in which the user can specify a limited number of values that can be allocated to the variable.
Example
#include <bits/stdc++.h> using namespace std; int main(){ //defining enum variable enum Gender { Male, Female }; 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; }
Output
Gender is Male
Advertisements