Opzione 5
This commit is contained in:
parent
19bcef7b32
commit
2ea8e1b4f1
30
Program.cs
30
Program.cs
@ -45,7 +45,15 @@ class Program {
|
|||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
//Console.WriteLine(CreaPalindromo(Input(), true));
|
stringa1 = Input();
|
||||||
|
stringa2 = Input();
|
||||||
|
if (string.Join("", InsertionSort(stringa1.ToLower().ToCharArray())).GetHashCode()
|
||||||
|
== string.Join("", InsertionSort(stringa2.ToLower().ToCharArray())).GetHashCode()) {
|
||||||
|
Console.WriteLine("Le due stringhe sono anagrammi");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Console.WriteLine("Le due stringhe non sono anagrammi");
|
||||||
|
}
|
||||||
Pausa();
|
Pausa();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -114,4 +122,24 @@ class Program {
|
|||||||
}
|
}
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char[] InsertionSort(char[] p_array)
|
||||||
|
{ //implementazione ufficiale copiata da Classroom
|
||||||
|
int i, j;
|
||||||
|
char temp;
|
||||||
|
|
||||||
|
for (i = 1; i < p_array.Length; i++)
|
||||||
|
{
|
||||||
|
temp = p_array[i];
|
||||||
|
j = i - 1;
|
||||||
|
while (j >= 0 && p_array[j] > temp)
|
||||||
|
{
|
||||||
|
p_array[j + 1] = p_array[j];
|
||||||
|
j--;
|
||||||
|
}
|
||||||
|
p_array[j + 1] = temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
return p_array;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
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_4")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("strings_4")]
|
||||||
[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+cce7ba546976b400f613cfa17cf408d3af20d0c1")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+19bcef7b32ce02a024c2dc77b5821602ee461441")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("strings_4")]
|
[assembly: System.Reflection.AssemblyProductAttribute("strings_4")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("strings_4")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("strings_4")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
b0c34602d823055cddc7c771d50c3fe4da181b0e802d7ba1da76f4950a2766be
|
a2becaf620581f78bcffa51b35925ed7300790c46ab7f249c18dbb7f038c0014
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user