1
Hello I am new in programming and I would like to know the most efficient way to make a "mini-decoder". I got the idea from my teacher who gave a duty that we had to take the number and turn it into letters to form a rsrs word (maybe a little bit of a price.. but..)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
string str;
string[] stra;
while (true)
{
str = Console.ReadLine();
stra = str.Split(' ');
for(int i = 0; i < stra.Length; i++)
{
switch (stra[i])
{
case "1":
Console.Write("z");
break;
case "2":
Console.Write("x");
break;
case "3":
Console.Write("v");
break;
case "4":
Console.Write("u");
break;
case "5":
Console.Write("t");
break;
case "6":
Console.Write("s");
break;
case "7":
Console.Write("r");
break;
case "8":
Console.Write("q");
break;
case "9":
Console.Write("p");
break;
case "10":
Console.Write("o");
break;
case "11":
Console.Write("n");
break;
case "12":
Console.Write("m");
break;
case "13":
Console.Write("l");
break;
case "14":
Console.Write("j");
break;
case "15":
Console.Write("i");
break;
case "16":
Console.Write("h");
break;
case "17":
Console.Write("g");
break;
case "18":
Console.Write("f");
break;
case "19":
Console.Write("e");
break;
case "20":
Console.Write("d");
break;
case "21":
Console.Write("c");
break;
case "22":
Console.Write("b");
break;
case "23":
Console.Write("a");
break;
}
}
Console.Write("\n");
}
}
}
}
good.. you write the sequence of numbers (from 1 to 23) separated by space and it turns the numbers into letters, forming the word.. I wonder if this is the most efficient way to do this and if you have some "exercises" for me to train -q
PS: Yes, there is no k,y,w on purpose at the teacher’s request.. rsrs