Category : binary

I have written a program to take in a text message and convert it to binary. How do I get it to also convert the space (0010 0000) between letters? int main(){ cout << "Enter plaintext: " << endl; string plaintext; cin >> plaintext; for(int i=0; i < plaintext.length(); i++){ bitset<8> plain(plaintext[i]); cout << plaintext[i] ..

Read more

#include <iostream> using namespace std; void binary(unsigned a) { int i; cout << "0" << endl; do { for (i = 1; i < a; i=i/2) { if ((a & i) != 0) { cout << "1" << endl; } else { cout << "0" << endl; } } } while (1 <= a && ..

Read more