fork(28) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. enum class NumericType
  5. {
  6. None = 0,
  7.  
  8. PadWithZero = 0x01,
  9. NegativeSign = 0x02,
  10. PositiveSign = 0x04,
  11. SpacePrefix = 0x08
  12. };
  13.  
  14. inline NumericType operator |(NumericType a, NumericType b)
  15. {
  16. return static_cast<NumericType>(static_cast<int>(a) | static_cast<int>(b));
  17. }
  18.  
  19. inline NumericType operator &(NumericType a, NumericType b)
  20. {
  21. return static_cast<NumericType>(static_cast<int>(a) & static_cast<int>(b));
  22. }
  23.  
  24. inline NumericType& operator |=(NumericType& a, NumericType b)
  25. {
  26. return a= a |b;
  27. }
  28.  
  29. int main() {
  30. // your code goes here
  31. NumericType a=NumericType::PadWithZero;
  32. a|=NumericType::NegativeSign;
  33. cout << static_cast<int>(a) ;
  34. return 0;
  35. }
Success #stdin #stdout 0s 3412KB
stdin
Standard input is empty
stdout
3