using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
enkripsi:
Console.Clear();
Console.WriteLine("ENKRIPSI");
Console.WriteLine();
Console.Write("input : ");
string input = Console.ReadLine();
char [] kata = input.ToCharArray();
string hsl ="";
for (int i = 0 ; i < input.Length ; i++)
{
switch (kata[i])
{
case 'z':
kata[i] = 'b';
kata[i]--;
kata[i]--;
break;
case 'Z':
kata[i] = 'B';
kata[i]--;
kata[i]--;
break;
case 'y':
kata[i] = 'a';
kata[i]--;
kata[i]--;
break;
case 'Y':
kata[i] = 'A';
kata[i]--;
kata[i]--;
break;
case ' ':
kata[i] = ' ';
kata[i]--;
kata[i]--;
break;
}
kata[i]++;
kata[i]++;
hsl = hsl + kata[i];
}
Console.WriteLine("output : {0}",hsl);
Console.ReadLine();
Console.WriteLine();
Console.WriteLine("DEKRIPSI");
Console.WriteLine();
Console.Write("input : ");
input = Console.ReadLine();
kata = input.ToCharArray();
hsl = "";
for (int i = 0; i < input.Length; i++)
{
switch (kata[i])
{
case 'b':
kata[i] = 'z';
kata[i]++;
kata[i]++;
break;
case 'B':
kata[i] = 'Z';
kata[i]++;
kata[i]++;
break;
case 'a':
kata[i] = 'y';
kata[i]++;
kata[i]++;
break;
case 'A':
kata[i] = 'Y';
kata[i]++;
kata[i]++;
break;
case ' ' :
kata[i] = ' ';
kata[i]++;
kata[i]++;
break;
}
kata[i]--;
kata[i]--;
hsl = hsl + kata[i];
}
Console.WriteLine("output : {0}", hsl);
Console.ReadKey();
goto enkripsi;
}
}
}
Tidak ada komentar:
Posting Komentar