I'm having a problem reading the characters I broke down into bits. Basically I'm trying to break the the character array down bitwise and put it back together (this is all part of a grander project I'm working on). I've discovered that it seems to be writing fine, but converting it back into a character string has given me complications.
int main() {
char input[10], output[10];
int bits[10][7];
cout<<"What 10 character string should I learn? ";
cin>>input;
for(int i=0; i<10; i++) {
for(int j=0; j<7; j++) {
bits[i][j] = input[i] & 1;
input[i] = input[i] >> 1;
}
}
for(int y=0; y<10; y++) {
for(int u=0; u<7; u++) {
output[y] = output[y] | bits[y][u];
output[y] = output[y] << 1;
}
}
for(int h=0; h<10; h++) {
cout<
}
return 0;
}
Any suggestions? Thanks.
2007-02-14
16:54:44
·
1 answers
·
asked by
Harb Frame
3
in
Computers & Internet
➔ Programming & Design