Hi all,
Been a while since I've posted on here since I don't have a C++ course this semester. I just got back into today and wanted to see if I could come up with a program that takes a phrase and "encrypts" it into ASCII binary code.
This is what i have so far.
I figured I'd need tell the program what each character stood for in ASCII binary. Was I correct in listing it like that in a voided function? Obviously it is missing the conversion, I didn't know where to start with that one. Ideas?
Thanks
Been a while since I've posted on here since I don't have a C++ course this semester. I just got back into today and wanted to see if I could come up with a program that takes a phrase and "encrypts" it into ASCII binary code.
This is what i have so far.
#include <iostream> #include <string> using namespace std; void conversion(string phrase) { char a = 01100001; char A = 01000001; char b = 01100010; char B = 01000010; char c = 01100011; char C = 01000011; char d = 01100100; char D = 01000100; char e = 01100101; char E = 01000101; char f = 01100110; char F = 01000110; char g = 01100111; char G = 01000111; char h = 01101000; char H = 01001000; char i = 01101001; char I = 01001001; char j = 01101010; char J = 01001010; char k = 01101011; char K = 01001011; char l = 01101100; char L = 01001100; char M = 01001101; char n = 01101110; char N = 01001110; char o = 01101111; char O = 01001111; char p = 01110000; char P = 01010000; char q = 01110001; char Q = 01010001; char r = 01110010; char R = 01010010; char s = 01110011; char S = 01010011; char t = 01110100; char T = 01010100; char u = 01110101; char U = 01010101; char v = 01110110; char V = 01010110; char w = 01110111; char W = 01010111; char x = 01111000; char X = 01011000; char y = 01111001; char Y = 01011001; char z = 01111010; char Z = 01011010; } int main(int argc, char** argv) { string phrase; cout << "Enter the text you would like to be encrypted." << endl; cin >> phrase; getline (cin, phrase); conversion(phrase); cout << phrase; return 0; }
I figured I'd need tell the program what each character stood for in ASCII binary. Was I correct in listing it like that in a voided function? Obviously it is missing the conversion, I didn't know where to start with that one. Ideas?
Thanks