From 94dc22499cbe7af1d6ae1ae95f7371787302b5d2 Mon Sep 17 00:00:00 2001 From: La Programmatrice Verde Date: Wed, 15 Jan 2025 08:48:16 +0100 Subject: [PATCH] =?UTF-8?q?Men=C3=B9=20+=20opzione=200=20+=20opzione=201?= =?UTF-8?q?=20(test=20di=20ritorno)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Program.cs | 89 +++++++++++++++++- ...CoreApp,Version=v9.0.AssemblyAttributes.cs | 4 + obj/Debug/net9.0/ripasso3.AssemblyInfo.cs | 22 +++++ .../net9.0/ripasso3.AssemblyInfoInputs.cache | 1 + ....GeneratedMSBuildEditorConfig.editorconfig | 15 +++ obj/Debug/net9.0/ripasso3.GlobalUsings.g.cs | 8 ++ obj/Debug/net9.0/ripasso3.assets.cache | Bin 0 -> 157 bytes 7 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs create mode 100644 obj/Debug/net9.0/ripasso3.AssemblyInfo.cs create mode 100644 obj/Debug/net9.0/ripasso3.AssemblyInfoInputs.cache create mode 100644 obj/Debug/net9.0/ripasso3.GeneratedMSBuildEditorConfig.editorconfig create mode 100644 obj/Debug/net9.0/ripasso3.GlobalUsings.g.cs create mode 100644 obj/Debug/net9.0/ripasso3.assets.cache diff --git a/Program.cs b/Program.cs index 4e48f29..d9f21c6 100644 --- a/Program.cs +++ b/Program.cs @@ -2,8 +2,95 @@ class Program { + const int minDimensione = 0; + const int maxDimensione = 100; static void Main(string[] args) { - Console.WriteLine("Hello, World!"); + int scelta; + int[] array = null; + + do{ + Console.WriteLine("Scegliere un'opzione:"); + Console.WriteLine("1. Crea un'insieme di numeri tra " + minDimensione + " e " + maxDimensione); + Console.WriteLine("2. Mostra il maggiore e il minore"); + Console.WriteLine("3. Calcolo media"); + Console.WriteLine("0. Esci"); + Console.Write("Scelta: "); + scelta=Convert.ToInt32(Console.ReadLine()); + + + switch (scelta){ + case 0: + Console.Clear(); + break; + case 1: + Console.Clear(); + array=CreaArray(); + StampaArray(array); + //StampaArray(CreaArray()); + Pausa(); + break; + case 2: + Console.Clear(); + + Pausa(); + break; + case 3: + Console.Clear(); + + Pausa(); + break; + + default: + Console.WriteLine("Scelta non valida"); + Pausa(); + break; + } + } + while (scelta!=0); + } + + static void Pausa(){ + Console.WriteLine("Premere invio per continuare. . ."); + Console.ReadLine(); + Console.Clear(); + } + static int[] CreaArray(){ + int dimensione, input, i = 0; + + do { + Console.Write("Quanti numeri vuoi inserire? "); + dimensione = Convert.ToInt32(Console.ReadLine()); + if (dimensione <= 0) { + Console.WriteLine("Devi inserire almeno un numero"); + } + } + while (dimensione <= 0); + + int[] ritorno=new int[dimensione]; + + do{ + Console.Clear(); + Console.WriteLine("Hai ancora " + (dimensione - i) + " numeri da inserire"); + Console.Write("Inserire un numero: "); + + input=Convert.ToInt32(Console.ReadLine()); + + if(input>=minDimensione && input<=maxDimensione){ + ritorno[i]=input; + i++; + } + else{ + Console.WriteLine("Il numero deve essere compreso tra 0 e 100, estremi inclusi"); + } + } + while(i +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/ripasso3.AssemblyInfo.cs b/obj/Debug/net9.0/ripasso3.AssemblyInfo.cs new file mode 100644 index 0000000..ba4e077 --- /dev/null +++ b/obj/Debug/net9.0/ripasso3.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("ripasso3")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+15c72c296c74744698fec0074b8acd25a1dfc2e1")] +[assembly: System.Reflection.AssemblyProductAttribute("ripasso3")] +[assembly: System.Reflection.AssemblyTitleAttribute("ripasso3")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/obj/Debug/net9.0/ripasso3.AssemblyInfoInputs.cache b/obj/Debug/net9.0/ripasso3.AssemblyInfoInputs.cache new file mode 100644 index 0000000..beaddc8 --- /dev/null +++ b/obj/Debug/net9.0/ripasso3.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +6705cc8617ec0c97465be09ce2330e1b3ccd4f7d2b8aa37d1fbe52005a4aff45 diff --git a/obj/Debug/net9.0/ripasso3.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net9.0/ripasso3.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..2fcb12f --- /dev/null +++ b/obj/Debug/net9.0/ripasso3.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 = ripasso3 +build_property.ProjectDir = /home/BrainTheBest5/git/ripasso3/ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = +build_property.EffectiveAnalysisLevelStyle = 9.0 +build_property.EnableCodeStyleSeverity = diff --git a/obj/Debug/net9.0/ripasso3.GlobalUsings.g.cs b/obj/Debug/net9.0/ripasso3.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/obj/Debug/net9.0/ripasso3.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/ripasso3.assets.cache b/obj/Debug/net9.0/ripasso3.assets.cache new file mode 100644 index 0000000000000000000000000000000000000000..976749bd40fe21b1caa142c5396e3bfb4dfcb1fb GIT binary patch literal 157 zcmWIWc6a1qU|?uHeMf(^E_I3lfvF6Vp?R^$8gW0H+}yP5=M^ literal 0 HcmV?d00001