Hey, I'm making a program that encrypts a phrase using a Ceaser cipher on which the key or offset is variable. I have very very little experience and I'm stuck on having the user input the to veriables.
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
int key = 0;// number of spaces to shift text
string input;// phrase to encrypt
int count = 0, length;
cout << "Enter an integer from 1-26 as your key ";
cin >> key;
cout << "Your offset value is: " << key <<endl;
cout << "Enter your phrase: \n";
getline(cin, input);
length = (int)input.length();
for (count = 0; count < length; count++)
{
if (isalpha(input[count]))
{
input[count] = tolower(input[count]);
for (int i = 0; i < key; i++)
{
if (input[count] == 'z')
input[count] = 'a';
else
input[count]++;
}
}
}
cout << "Results: \n" << input << endl;
}
Put the code you need help with here.