或的方式触发多个条件 #include <iostream> using namespace std; typedef enum Binary {ConditionA = 0x0, ConditionB = 0x1, ConditionC = 0x2, ConditionD = 0x4, ConditionE = 0x8, ConditionF = 0x10,ConditionG = 0x20,ConditionH = 0x40,ConditionI = 0x80 }Bin;void func(Bin enBin) {if (enBin & ConditionB){cout << "ConditionB" << endl;}if (enBin & ConditionC){cout << "ConditionC" << endl;}if (enBin & ConditionD){cout << "ConditionD" << endl;}if (enBin & ConditionE){cout << "ConditionE" << endl;}} void main() {Bin enBin;enBin = Bin(ConditionB | ConditionC | ConditionE);func(enBin);while (1){} }