I need to create a function that outputs all possible binary combinations. I'm really stumped on this. I have to do it with nested loops, and am not sure how to go about it. Below is what I tried so far.
void outputBinary(){
int a[2][2][2][2][2][2][2][2];
for (int i = 0; i < 2; i++){
for (int j = 0; j < 2; j++){
for (int k = 0; k < 2; k++){
for (int l = 0; l < 2; l++){
for (int m = 0; m < 2; m++){
for (int n = 0; n < 2; n++){
for (int o = 0; o < 2; o++){
for (int p = 0; p < 2; p++){
cout << a[i][j][k][l][m][n][o][p];
}
cout << endl;
}
cout << endl;
}
cout << endl;
}
cout << endl;
}
cout << endl;
}
cout << endl;
}
cout << endl;
}
cout << endl;
}