I had
char boolsToChar(bool* bools){
char c = 0;
for( int i = 0; i < 8; i++ )
if( bools[i] )
c += pow(2,i);
return c;
}
but clearly this is not as nice a solution as above, For multiple reasons.
One being that I get a warning for converting a double to a char and two I have a conditional statment that i clearly don't require
Anyhow the solution above compiled for me, but I needed to change it around a little to come up with 'A'.
bool bits[] = {1, 0, 0, 0, 0, 0, 1, 0};
char c = 0;
for(int i = 0; i < 8; i++)
c += (bits[i] << i); // 0 or 1 times 2 to the ith power
cout << c << endl; // should print out A
cin.get();