Add files via upload
This commit is contained in:
parent
5d4938962f
commit
ab5c493ee5
34
Program.cs
Normal file
34
Program.cs
Normal file
@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
8
Shift_Cipher.csproj
Normal file
8
Shift_Cipher.csproj
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
25
Shift_Cipher.sln
Normal file
25
Shift_Cipher.sln
Normal file
@ -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
|
||||||
Loading…
x
Reference in New Issue
Block a user