Чар до бинарного
#include <iostream>
#include<string>
#include<list>
using namespace std;
int main()
{
while (true) {
cout << endl << "Enter your char : " << endl;
char c;
int result[8] = {};
cin >> c;
int ascii_value = (int)c;
cout << "Ascii = " << ascii_value << endl;
try {
for (int count = 0; count < 8; count++) {
if (ascii_value % 2 == 0) {
ascii_value = ascii_value / 2;
//cout << "0";
result[count] = 0;
}
else {
//cout << "1";
result[count] = 1;
ascii_value = (ascii_value - 1) / 2;
}
}
}
catch (...)
{
cout << "PASS";
}
for (int count = 7; count > -1; count--) {
cout << result[count];
}
}
}\\ by ismail mazumder
Yucky Yak