11011000 10110001 11011001 10001000 11011000 10110010 11011000 10101010 11011001 10001000 11011001 10000110 00100000 11011001 10000101 11011000 10101000 11011000 10100111 11011000 10110001 11011010 10101001 00100000 11011000 10101000 11011000 10110001 11011001 10000110 11011000 10100111 11011001 10000101 11011001 10000111 00100000 11011001 10000110 11011001 10001000 11011011 10001100 11011000 10110011 00100000 11011001 10000111 11011000 10100111 11011011 10001100 00100000 11011000 10101010 11011000 10100111 11011000 10110010 11011001 10000111 00100000 11011010 10101001 11011000 10100111 11011000 10110001
#include <iostream>
#include <string>
using namespace std;
unsigned char toDecimal(string binary) {
unsigned char number = 0;
for (int i = 0; i < 8; i++) {
number = number * 2 + (binary[i] - '0');
}
return number;
}
int main() {
string binary;
string text;
cout << "Binary: ";
getline(cin, binary);
string byte = "";
for (char c : binary) {
if (c == '0' || c == '1') {
byte += c;
if (byte.length() == 8) {
unsigned char decimal = toDecimal(byte);
text += decimal;
byte = "";
}
}
}
cout << "Text: " << text << endl;
return 0;
}
💻
@Montakhab_Comp |
@Binary_squad