diff --git a/Program.cs b/Program.cs index d1ec1b4..e080c38 100644 --- a/Program.cs +++ b/Program.cs @@ -4,6 +4,58 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + int[] array = new int [Dimensione()]; + InserimentoValoriArray(array); + ScambioValoreMinimo(array); + BubbleSort(array); + } + static int Dimensione(){ + int ritorno; + do { + Console.Write("Quanto grande deve essere l'array? "); + ritorno = Convert.ToInt32(Console.ReadLine()); + if (ritorno <= 1) { + Console.WriteLine("L'array deve avere una dimensione maggiore di uno"); + } + } + while (ritorno <= 1); + return ritorno; + } + static void InserimentoValoriArray(int[] p_array){ + for (int i=0; i p_array[j + 1]) {//se la cella a sinistra è maggiore di quella a destra + numeroScambi++;//conto il numero di scambi che effettuo (che coincide con il numero di volte in cui la condizione qui sopra sia vera) + temp = p_array[j]; //memorizzo la cella da cambiare (a sinistra) + p_array[j] = p_array[j + 1]; //sovrascrivo la cella a sinistra con quella a destra (la maggiore) + p_array[j + 1] = temp;//sovrascrivo la cella a destra con il valore originale di quella a sinistra + } + } + } + Console.WriteLine("Numero scambi: " + numeroScambi); } } diff --git a/bin/Debug/net9.0/sorting_proximity b/bin/Debug/net9.0/sorting_proximity new file mode 100755 index 0000000..3a2c643 Binary files /dev/null and b/bin/Debug/net9.0/sorting_proximity differ diff --git a/bin/Debug/net9.0/sorting_proximity.deps.json b/bin/Debug/net9.0/sorting_proximity.deps.json new file mode 100644 index 0000000..fa3c05a --- /dev/null +++ b/bin/Debug/net9.0/sorting_proximity.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v9.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v9.0": { + "sorting_proximity/1.0.0": { + "runtime": { + "sorting_proximity.dll": {} + } + } + } + }, + "libraries": { + "sorting_proximity/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/bin/Debug/net9.0/sorting_proximity.dll b/bin/Debug/net9.0/sorting_proximity.dll new file mode 100644 index 0000000..9ce77e5 Binary files /dev/null and b/bin/Debug/net9.0/sorting_proximity.dll differ diff --git a/bin/Debug/net9.0/sorting_proximity.pdb b/bin/Debug/net9.0/sorting_proximity.pdb new file mode 100644 index 0000000..a22486c Binary files /dev/null and b/bin/Debug/net9.0/sorting_proximity.pdb differ diff --git a/bin/Debug/net9.0/sorting_proximity.runtimeconfig.json b/bin/Debug/net9.0/sorting_proximity.runtimeconfig.json new file mode 100644 index 0000000..b19c3c8 --- /dev/null +++ b/bin/Debug/net9.0/sorting_proximity.runtimeconfig.json @@ -0,0 +1,12 @@ +{ + "runtimeOptions": { + "tfm": "net9.0", + "framework": { + "name": "Microsoft.NETCore.App", + "version": "9.0.0" + }, + "configProperties": { + "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false + } + } +} \ No newline at end of file diff --git a/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs b/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs new file mode 100644 index 0000000..9e76325 --- /dev/null +++ b/obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs @@ -0,0 +1,4 @@ +// +using System; +using System.Reflection; +[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v9.0", FrameworkDisplayName = ".NET 9.0")] diff --git a/obj/Debug/net9.0/apphost b/obj/Debug/net9.0/apphost new file mode 100755 index 0000000..3a2c643 Binary files /dev/null and b/obj/Debug/net9.0/apphost differ diff --git a/obj/Debug/net9.0/ref/sorting_proximity.dll b/obj/Debug/net9.0/ref/sorting_proximity.dll new file mode 100644 index 0000000..49fb610 Binary files /dev/null and b/obj/Debug/net9.0/ref/sorting_proximity.dll differ diff --git a/obj/Debug/net9.0/refint/sorting_proximity.dll b/obj/Debug/net9.0/refint/sorting_proximity.dll new file mode 100644 index 0000000..49fb610 Binary files /dev/null and b/obj/Debug/net9.0/refint/sorting_proximity.dll differ diff --git a/obj/Debug/net9.0/sorting_proximity.AssemblyInfo.cs b/obj/Debug/net9.0/sorting_proximity.AssemblyInfo.cs new file mode 100644 index 0000000..e20d8cd --- /dev/null +++ b/obj/Debug/net9.0/sorting_proximity.AssemblyInfo.cs @@ -0,0 +1,22 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +using System; +using System.Reflection; + +[assembly: System.Reflection.AssemblyCompanyAttribute("sorting_proximity")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+9164a62f9e443a5a7ccbe17b05930889bd2c2776")] +[assembly: System.Reflection.AssemblyProductAttribute("sorting_proximity")] +[assembly: System.Reflection.AssemblyTitleAttribute("sorting_proximity")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/obj/Debug/net9.0/sorting_proximity.AssemblyInfoInputs.cache b/obj/Debug/net9.0/sorting_proximity.AssemblyInfoInputs.cache new file mode 100644 index 0000000..df7d5a3 --- /dev/null +++ b/obj/Debug/net9.0/sorting_proximity.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +c22826eab3b2e5493e6d270aec65243f5dd384d61e47a0c286073aa07b67762a diff --git a/obj/Debug/net9.0/sorting_proximity.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net9.0/sorting_proximity.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..a801233 --- /dev/null +++ b/obj/Debug/net9.0/sorting_proximity.GeneratedMSBuildEditorConfig.editorconfig @@ -0,0 +1,15 @@ +is_global = true +build_property.TargetFramework = net9.0 +build_property.TargetPlatformMinVersion = +build_property.UsingMicrosoftNETSdkWeb = +build_property.ProjectTypeGuids = +build_property.InvariantGlobalization = +build_property.PlatformNeutralAssembly = +build_property.EnforceExtendedAnalyzerRules = +build_property._SupportedPlatformList = Linux,macOS,Windows +build_property.RootNamespace = sorting_proximity +build_property.ProjectDir = /home/Verde/git/sorting_proximity/ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = +build_property.EffectiveAnalysisLevelStyle = 9.0 +build_property.EnableCodeStyleSeverity = diff --git a/obj/Debug/net9.0/sorting_proximity.GlobalUsings.g.cs b/obj/Debug/net9.0/sorting_proximity.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/obj/Debug/net9.0/sorting_proximity.GlobalUsings.g.cs @@ -0,0 +1,8 @@ +// +global using global::System; +global using global::System.Collections.Generic; +global using global::System.IO; +global using global::System.Linq; +global using global::System.Net.Http; +global using global::System.Threading; +global using global::System.Threading.Tasks; diff --git a/obj/Debug/net9.0/sorting_proximity.assets.cache b/obj/Debug/net9.0/sorting_proximity.assets.cache new file mode 100644 index 0000000..a3aff1b Binary files /dev/null and b/obj/Debug/net9.0/sorting_proximity.assets.cache differ diff --git a/obj/Debug/net9.0/sorting_proximity.csproj.CoreCompileInputs.cache b/obj/Debug/net9.0/sorting_proximity.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..1fcbb52 --- /dev/null +++ b/obj/Debug/net9.0/sorting_proximity.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +23cd7bfe049ffd352513a5e6e4865bba544b1843494ccf0ca4f5ecdd6fb49904 diff --git a/obj/Debug/net9.0/sorting_proximity.csproj.FileListAbsolute.txt b/obj/Debug/net9.0/sorting_proximity.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..783b824 --- /dev/null +++ b/obj/Debug/net9.0/sorting_proximity.csproj.FileListAbsolute.txt @@ -0,0 +1,14 @@ +/home/Verde/git/sorting_proximity/bin/Debug/net9.0/sorting_proximity +/home/Verde/git/sorting_proximity/bin/Debug/net9.0/sorting_proximity.deps.json +/home/Verde/git/sorting_proximity/bin/Debug/net9.0/sorting_proximity.runtimeconfig.json +/home/Verde/git/sorting_proximity/bin/Debug/net9.0/sorting_proximity.dll +/home/Verde/git/sorting_proximity/bin/Debug/net9.0/sorting_proximity.pdb +/home/Verde/git/sorting_proximity/obj/Debug/net9.0/sorting_proximity.GeneratedMSBuildEditorConfig.editorconfig +/home/Verde/git/sorting_proximity/obj/Debug/net9.0/sorting_proximity.AssemblyInfoInputs.cache +/home/Verde/git/sorting_proximity/obj/Debug/net9.0/sorting_proximity.AssemblyInfo.cs +/home/Verde/git/sorting_proximity/obj/Debug/net9.0/sorting_proximity.csproj.CoreCompileInputs.cache +/home/Verde/git/sorting_proximity/obj/Debug/net9.0/sorting_proximity.dll +/home/Verde/git/sorting_proximity/obj/Debug/net9.0/refint/sorting_proximity.dll +/home/Verde/git/sorting_proximity/obj/Debug/net9.0/sorting_proximity.pdb +/home/Verde/git/sorting_proximity/obj/Debug/net9.0/sorting_proximity.genruntimeconfig.cache +/home/Verde/git/sorting_proximity/obj/Debug/net9.0/ref/sorting_proximity.dll diff --git a/obj/Debug/net9.0/sorting_proximity.dll b/obj/Debug/net9.0/sorting_proximity.dll new file mode 100644 index 0000000..9ce77e5 Binary files /dev/null and b/obj/Debug/net9.0/sorting_proximity.dll differ diff --git a/obj/Debug/net9.0/sorting_proximity.genruntimeconfig.cache b/obj/Debug/net9.0/sorting_proximity.genruntimeconfig.cache new file mode 100644 index 0000000..1c1e8b0 --- /dev/null +++ b/obj/Debug/net9.0/sorting_proximity.genruntimeconfig.cache @@ -0,0 +1 @@ +24eb914aab136ea75fd7346a673f999dd04017fa638348224da58e591929b2ec diff --git a/obj/Debug/net9.0/sorting_proximity.pdb b/obj/Debug/net9.0/sorting_proximity.pdb new file mode 100644 index 0000000..a22486c Binary files /dev/null and b/obj/Debug/net9.0/sorting_proximity.pdb differ