diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..fa032d1 --- /dev/null +++ b/Program.cs @@ -0,0 +1,34 @@ +using System; + +namespace Shift_Cipher +{ + class Program + { + static void Main(string[] args) + { + string shiftedAlphabet = "", finalStr = "", alphabet = "abcdefghijklmnopqrstuvwxyz"; + Console.Write("Enter a string to be shifted: "); + string input = Console.ReadLine(); + Console.Write("Enter an amount to shift the string between 1 and 25 inclusive: "); + string shiftS = Console.ReadLine(); + int shift = Convert.ToInt32(shiftS); + shiftedAlphabet += alphabet.Substring(shift) + alphabet.Substring(0, shift); + input = input.ToLower(); + for(int i = 0; i < input.Length; i++) + { + if (input.Substring(i, 1).Equals(" ")) + { + finalStr += " "; + continue; + } + for(int j = 0; j < alphabet.Length; j++) + { + if (input.Substring(i, 1).Equals(alphabet.Substring(j, 1))) + finalStr += shiftedAlphabet.Substring(j, 1); + } + } + Console.WriteLine("Shifted String: " + finalStr); + + } + } +} diff --git a/Shift_Cipher.csproj b/Shift_Cipher.csproj new file mode 100644 index 0000000..d453e9a --- /dev/null +++ b/Shift_Cipher.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp3.1 + + + diff --git a/Shift_Cipher.sln b/Shift_Cipher.sln new file mode 100644 index 0000000..6c2b385 --- /dev/null +++ b/Shift_Cipher.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30320.27 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Shift_Cipher", "Shift_Cipher\Shift_Cipher.csproj", "{3720F8E0-09B0-47FB-AED7-81451CD7558D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3720F8E0-09B0-47FB-AED7-81451CD7558D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3720F8E0-09B0-47FB-AED7-81451CD7558D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3720F8E0-09B0-47FB-AED7-81451CD7558D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3720F8E0-09B0-47FB-AED7-81451CD7558D}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {B3BEA252-4714-4C9F-AFD6-06D70481A1CC} + EndGlobalSection +EndGlobal