How to add more int var into this program
In this programm i added only one int, A,in witch I have to write a combiniations of zeros or ones to it, but what if I want to add something like int A,B, C, D; Each can eather have 1 or 0, how can I write switch command using more int vagiables e.g. A =1 B=0 C=0 D=0 Output: 8 #include <iostream> using namespace std; int main () { int A; cin >> A ; switch (A) { case 0 : cout << "0"; break; case 1 : cout << "1"; break; case 10 : cout << "2"; break; case 11 : cout << "3"; break; case 100 : cout << "4"; break; case 101 : cout << "5"; break; case 110 : cout << "6"; break; case 111 : cout << "7"; break; case 1000 : cout << "8"; break; case 1001 : cout << "9"; break; case 1010 : cout << "10"; break; case 1011 : cout << "11"; break; case 1100 : cout << "12"; break; case 1101 : cout << "13"; break; case 1110 : cout << "14"; break; case 1111 : cout << "15"; break; default : cout << "Error"; } cout << endl; system("pause"); return 0; }