Hello, I'm new to programming and would like to know the most efficient way to do a "mini-decoder". I took the idea of my teacher who gave a duty that we had to take the number and turn it into letters to form a word rsrs (maybe a little prezinho .. 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 has some "exercises" for me to train -q
PS: Yes, there is no k, y, w purposely at the request of the teacher .. rsrs