Question: /******************** *Payton Murray *vigenere cipher *CSC 442 ********************/ #include #include using namespace std; // String declarations string eord, key, word; // the encrpyting function it

/******************** *Payton Murray *vigenere cipher *CSC 442 ********************/ #include #include using namespace std; // String declarations string eord, key, word; // the encrpyting function it accepts two arguments // the word that the user gave and the key specified by command line args void Encrypt(string enc, string key) { string result; int k=0; // the main loop that actually encrpyts each letter of the word for (int i=0; i "; getline(cin, word); // the if else statement that checks for encoding or decoding if (eord =="-e") Encrypt(word, key); else if( eord == "-d") { cout << "HEY " << endl; } } return 0; }

This is my code so far i cant figure out the decoding part. i am running the program in linux a such ./cipher -e key this is for encoding it works however it doetn do spaces for example if i put in hello world it will translate the " " as R. any way i need it to match the following exxamples:

jgourd@latech:~$ ./vigenere -e key hello <-- I typed this rijvs <-- my code generated this HELLO <-- I typed this RIJVS <-- my code generated this ^C <-- I pressed Ctrl+C jgourd@latech:~$ ./vigenere -e KEY hello rijvs HELLO RIJVS ^C jgourd@latech:~$ ./vigenere -d key rijvs hello RIJVS HELLO ^C jgourd@latech:~$ ./vigenere -d KEY rijvs hello RIJVS HELLO ^C jgourd@latech:~$ ./vigenere -e "This is my key" hello world altdw oapvh This is my message that I am sending you! Moqk qk yw wiqlhow bzmr S ek llvvqfs wyy! Get ready for Cyber Storm dudes! We're going to video game your butts on May 5! Zlb jmspw psp Vfjwz Kfmbq bnkmk! Ew'dc qsggn bg dapcy kyfl ggcj nsdxq hu Usg 5! ^C jgourd@latech:~$ ./vigenere -d "This is my wrong key" Zlb jmspw psp Vfjwz Kfmbq bnkmk! Ew'dc qsggn bg dapcy kyfl ggcj nsdxq hu Usg 5! Get ready tbb Izzsb Ryeji jbmqt! Qj'xs munzf jy lorgh wlzb cijc favfe jy Det 5! ^C jgourd@latech:~$ ./vigenere -d "This is my key" Zlb jmspw psp Vfjwz Kfmbq bnkmk! Ew'dc qsggn bg dapcy kyfl ggcj nsdxq hu Usg 5! Get ready for Cyber Storm dudes! We're going to video game your butts on May 5! ^C

my code is in c++ any help would be great thank you!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!