1. Home
  2. /
  3. Blog
  4. /
  5. شرح enumeration in c++
C++

شرح enumeration in c++

October 1, 2022 1 min read 2,299
شرح enumeration in c++
#include <string>
using namespace std;

int main()
{

// enum ..  enumration
        // 0    1     2     3
enum colrs{ red,blue,black,white };

cout<<red<<"  :  "<<blue<<"  :  "<<black<<"  :   "<<white<<endl;

}
//--------------------
#include <iostream>
#include <string>
using namespace std;

int main()
{

// enum ..  enumration
        // 0    1     2     3
enum colrs{ red=50,blue,black=60,white };


cout<<red<<"  :  "<<blue<<"  :  "<<black<<"  :   "<<white<<endl;


}
Share:
Read next

Related articles