*Please write code in both C and C+ language to be chosen as best answer. Please
ID: 642017 • Letter: #
Question
*Please write code in both C and C+ language to be chosen as best answer. Please answer each part of the question with thorough explanation*
Consider the following program that is designed to perform Caesar encryption method.
Type, compile, run, and observe the output.
Is there any bug or deficiency concerning the solution?If yes what are they and how can be fixed?
Modify the program (code) such that it could shift the string by any number between 1 and 26.
Modify the program (code) such that the user can run it as many time as he/she wants.
You should provide digital and hard copy of your work.
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char **argv)
{
string input;
int count = 0, length ;
cout <<" Enter your phrase:"<<endl;
getline (cin, input);
length = (int) input.length ();
for (count = 0; count < length; count++)
{
if (isalpha (input [count]))
{
for (int i = 0; i < 12; i++)
{
if (input [count] == 'z')
input [count] = 'a' ;
else
input[count] ++;
}
}
}
cout << " Results: " << input<<endl;
system("PAUSE");
return EXIT_SUCCESS;
}
Explanation / Answer
A. a C Source Code Example for Ceaser Cipher
B. a c++ code for the Caesar Cipher
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.