I was trying to make a similar function that return the binary in a string:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
string Binary(constchar& c) {
int r;
string out;
if ((int)c <= 1) {
out += (int)c;
return"";
}
r = (int)c % 2;
Binary((int)c >> 1);
stringstream ss;
ss << r;
out += ss.str();
return out;
}
The function might not be finished yet (I don't know does it work well) so I was debugging to finish it of course and I found that the identifier 'c' was out of scope wtf!!! Why??? And I want the function to be finished, too. Thanks.