Answers for "enum c++"

C++
1

enum c++

enum Colors
{
        BLACK,
        GREEN,
        BLUE,
        RED
};
Posted by: Guest on November-17-2020
2

enum c++

enum season { spring, summer, autumn, winter };
Posted by: Guest on April-25-2021
5

enum c++

enum Foo { a, b, c = 10, d, e = 1, f, g = f + c };
//a = 0, b = 1, c = 10, d = 11, e = 1, f = 2, g = 12
Posted by: Guest on March-23-2020
2

enum in c++

#include <iostream>
enum Example :unsigned char // char will work but float will not work because it is not an interger
{
	A = 9, B = 56, c = 12//values must be integers
};//enum is a just a name for a group of numeric values 
int main()
{
	Example example = A;
	//	Example example2 = 5;// This gives error because the values must be A , B ,C no other values are accepted in our code however we can break this behaiour in c++
	if (example == A)//We can use A directly because it is just an unsigned char var but is grouped in Example enum with other values
		std::cout << "Good" << std::endl;
	std::cin.get();
  
}
Posted by: Guest on August-04-2020
0

enum c++

enum season 
{   spring = 0, 
    summer = 4, 
    autumn = 8,
    winter = 12
};
Posted by: Guest on May-27-2021
-1

enum c++

enum names {blah1, Blah2 , blah3};
Posted by: Guest on October-20-2020

Browse Popular Code Answers by Language