I am having trouble getting a program to work. Essentially I want to use a keyword that that encypers a string that i enter Letter by letter
so if I used "bacon" as my keyword and
"Meet me at the park at eleven am " as the string to encyper. I want the output to be Negh zf av huf pcfx bt gzrwep oz.
What i have written so far is
#include
//get keyword in command line int main(int argc, char* argv[]) { //********************** test to see if int argc and char* argv were working correctly //printf("%s", argv[0]); //printf("%s\n\n\n", argv[1]); //****************************** //take string from argv and change use it to change chars printed in code printf("Type in words to encode"); string p = GetString(); string k = argv[1]; printf("%s", k);
for(int i = 0, n = strlen(p), j= 0; i < n; i++, j++) { //q stands for quantity because n was taken // for(int j = 0, q = strlen(k); j < q; j++) //{ int c = (p[i] + k[j]); char test=p[i]; printf("%iXX %c", c, test); //} } return 0; }
ALso sting is the same as char*
Join our real-time social learning platform and learn together with your friends!