Hello, I’m working on this task:
We like ciphers at the resistance base. For internal communication, we use a substitutional cipher. The idea is very simple: every letter in the incoming message is substituted with a different symbol. Your task is to partially encode a string message given to your program as an input and output the encoded message. Leave all letters except for the following:
- F and f: replace with !
- G and g: replace with @
- T and t: replace with #
- H and h: replace with $
- Y and y: replace with %
- B and b: replace with ^
For Example:
>After seeinG my dark Future, I can’t continue living in the Boring past.
A!#er seein@ m% dark !u#ure, I can’# con#inue livin@ in #$e ^orin@ pas#.
Here is my code:
namespace SwitchStatement
{
class SubstitutionCipher
{
static void Main()
{
var message = Console.ReadLine();
//var lowerMessage = message;
//char.ToLower(lowerMessage);
for (int i = 0; i < message.Length; i++)
{
switch (message[i])
{
case 'f':
Console.Write('!');
break;
case 'g':
Console.Write('@');
break;
case 't':
Console.Write('#');
break;
case 'h':
Console.Write('$');
break;
case 'y':
Console.Write('%');
break;
case 'b':
Console.Write('^');
break;
default:
Console.Write(message[i]);
break;
}
}
}
}
}
Can anyone please help me to solve it?