char to binary

First, you can use the standard library to convert a character to its binary representation.

Here's the code to convert a char to binary in C++:

#include <bitset>
#include <iostream>

int main() {
    char c = 'A';
    std::bitset<8> binary(c);
    std::cout << binary << std::endl;
    return 0;
}