Opzione 5 e 6
This commit is contained in:
parent
7775755438
commit
2870aa6941
20
Program.cs
20
Program.cs
@ -17,7 +17,7 @@ class Program {
|
|||||||
Console.WriteLine("3. Primo carattere maiuscolo");
|
Console.WriteLine("3. Primo carattere maiuscolo");
|
||||||
Console.WriteLine("4. Sostituisci sottostringa");
|
Console.WriteLine("4. Sostituisci sottostringa");
|
||||||
Console.WriteLine("5. Parola palindroma pari");
|
Console.WriteLine("5. Parola palindroma pari");
|
||||||
Console.WriteLine("5. Parola palindroma dispari");
|
Console.WriteLine("6. Parola palindroma dispari");
|
||||||
Console.WriteLine("0. Esci");
|
Console.WriteLine("0. Esci");
|
||||||
Console.Write("Scelta: ");
|
Console.Write("Scelta: ");
|
||||||
scelta = Convert.ToInt32(Console.ReadLine());
|
scelta = Convert.ToInt32(Console.ReadLine());
|
||||||
@ -72,12 +72,12 @@ class Program {
|
|||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
//PariEDispari();
|
Console.WriteLine(CreaPalindromo(Input(), true));
|
||||||
Pausa();
|
Pausa();
|
||||||
break;
|
break;
|
||||||
case 6:
|
case 6:
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
//PariEDispari();
|
Console.WriteLine(CreaPalindromo(Input(), false));
|
||||||
Pausa();
|
Pausa();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -196,5 +196,19 @@ class Program {
|
|||||||
return ritorno;
|
return ritorno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static string CreaPalindromo(string p_stringa, bool isPari) {
|
||||||
|
string ritorno = p_stringa;
|
||||||
|
int partenza;
|
||||||
|
if (isPari) {
|
||||||
|
partenza = p_stringa.Length - 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
partenza = p_stringa.Length - 2;
|
||||||
|
}
|
||||||
|
for (int i = partenza; i > -1; i--) {
|
||||||
|
ritorno = ritorno + p_stringa[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return ritorno;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("strings_3")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("strings_3")]
|
||||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+6415a06c85cfa74b112fb81faf09820fc9a42aaf")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+7775755438b30c3353b3d8c6fc93a3237e54b33a")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("strings_3")]
|
[assembly: System.Reflection.AssemblyProductAttribute("strings_3")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("strings_3")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("strings_3")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
daf4d26f162aad74b0d6ca9d5e46d1f534c7df8294bd270db72667436b646006
|
f69ddd740cdd255e20227bb1b23ca150ec3c9b6db7d226c093d6158f696c960d
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user