static private char Encrypt(int x)
public static void Main()
Console.WriteLine("Press enter to generate a random shift cipher key.");
Console.WriteLine("Your key is: " + q);
Console.WriteLine("Press enter to see your cipher text.");
char[] ciphertext = new char[26];
for (int i = 0; i < 26; i++)
int shift = (i + q) % 26;
ciphertext[i] = Encrypt(shift);
string b = new string (ciphertext);
Console.WriteLine(ciphertext);
Console.WriteLine("Press enter to type in text to encrypt.");
Console.WriteLine("Please enter you plain text in all capital letters.");
string plain = Console.ReadLine().ToUpper();
char[] temp = plain.ToCharArray();
string alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
char[] alpha = alphabet.ToCharArray();
for (int i = 0; i < plain.Length; i++)
for (int j = 0; j < 26; j++)
int shift = (j + q) % 26;
temp[i] = Encrypt(shift);
else if(temp[i] != alpha[j]&& count==25)
string final = new string(temp);
Console.WriteLine(final);