-2
please. see the code at this link: https://pastebin.com/raw/rDCZQhtf and tell me why the sentence doesn’t come out with the jumbled lyrics; if possible, give me an idea of how to do the same thing with Menas line
string frase,frase0;
Console.WriteLine("Digite a frase: ");
frase0 = Console.ReadLine();
frase = frase0;
foreach(var a in frase0) {
if(a == 'a'){
frase.Replace(a, 'g');
}else if(a == 'b'){
frase.Replace(a, 'h');
}else if(a == 'c'){
frase.Replace(a, 'e');
}else if(a == 'd'){
frase.Replace(a, 'j');
}else if(a == 'e'){
frase.Replace(a, 'k');
}else if(a == 'f'){
frase.Replace(a, 'l');
}else if(a == 'g'){
frase.Replace(a, 'm');
}else if(a == 'h'){
frase.Replace(a, 'n');
}else if(a == 'i'){
frase.Replace(a, 'o');
}else if(a == 'j'){
frase.Replace(a, 'p');
}else if(a == 'k'){
frase.Replace(a, 'q');
}else if(a == 'l'){
frase.Replace(a, 'r');
}else if(a == 'm'){
frase.Replace(a, 's');
}else if(a == 'n'){
frase.Replace(a, 't');
}else if(a == 'o'){
frase.Replace(a, 'u');
}else if(a == 'p'){
frase.Replace(a, 'v');
}else if(a == 'q'){
frase.Replace(a, 'w');
}else if(a == 'r'){
frase.Replace(a, 'x');
}else if(a == 's'){
frase.Replace(a, 'y');
}else if(a == 't'){
frase.Replace(a, 'z');
}else if(a == 'u'){
frase.Replace(a, 'a');
}else if(a == 'v'){
frase.Replace(a, 'b');
}else if(a == 'w'){
frase.Replace(a, 'c');
}else if(a == 'x'){
frase.Replace(a, 'd');
}else if(a == 'y'){
frase.Replace(a, 'e');
}else if(a == 'z'){
frase.Replace(a, 'f');
}
}
Console.WriteLine(frase);
//that’s just the part that’s not working
put the code here in the question please
– Rovann Linhalis
Use the link [Edit] to add information to the question. The space below you used is for answers only. Take the opportunity to explain in more detail what the problem is, what the code should do (what the result should be) versus what it is doing, etc. In other words, do what we call [mcve]
– hkotsubo
First you need to define a criterion for shuffling, it should be random, it should be just a simple switch as it was and it will always be so (which technically is not shuffling). If doing what you put in the code is not scrambling and it’s not just too many lines, it’s extremely inefficient.
– Maniero