Opzione 2 non c'ho sbatti edition
This commit is contained in:
parent
d29d204ee4
commit
8d0599b65c
39
Program.cs
39
Program.cs
@ -31,13 +31,7 @@ class Program {
|
||||
break;
|
||||
case 2:
|
||||
Console.Clear();
|
||||
Console.Write("Inserire una frase: ");
|
||||
//if (Palindromo(Console.ReadLine())) {
|
||||
Console.WriteLine("La frase è palindroma");
|
||||
//}
|
||||
//else {
|
||||
Console.WriteLine("La frase non è palindroma");
|
||||
//}
|
||||
Console.WriteLine(Codifica());
|
||||
Pausa();
|
||||
break;
|
||||
case 3:
|
||||
@ -108,4 +102,35 @@ class Program {
|
||||
}
|
||||
Console.WriteLine();
|
||||
}
|
||||
|
||||
static string Codifica() {
|
||||
string stringa = Input();
|
||||
char codice = 'f';
|
||||
const char inutile = '\\';
|
||||
char[] ritorno = new char[stringa.Length * 2];
|
||||
Array.Fill(ritorno, inutile);
|
||||
char[] vocali = { 'a', 'e', 'i', 'o', 'u' };
|
||||
int k = 0;
|
||||
|
||||
|
||||
for (int i = 0; i < stringa.Length; i++) {
|
||||
ritorno[k] = stringa[i];
|
||||
for (int j = 0; j < vocali.Length; j++) {
|
||||
if (stringa[i] == vocali[j]) {
|
||||
k++;
|
||||
ritorno[k] = codice;
|
||||
break;
|
||||
}
|
||||
else if (stringa[i] == char.ToUpper(vocali[j])) {
|
||||
k++;
|
||||
ritorno[k] = char.ToUpper(codice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
k++;
|
||||
|
||||
}
|
||||
|
||||
return string.Join("", ritorno).Split(inutile).First();
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,10 +13,10 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("strings_3")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f7c77cc677e2aad807832fec2775b0341e41ffd3")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d29d204ee494646ce5094700197a900b05cc44aa")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("strings_3")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("strings_3")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
// Generato dalla classe WriteCodeFragment di MSBuild.
|
||||
|
||||
|
||||
@ -1 +1 @@
|
||||
437b533b5127f5b1e5d132098240dac87416d889e2ff513387be247f3341bce6
|
||||
cbb955859c30d97643b375ba8ca1883b485f554c16cef8a828a4aa0bf8968236
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user