From 7e5fac9c45b8f529b7ccc0e23ab68c56ed8e876f Mon Sep 17 00:00:00 2001 From: La Programmatrice Verde Date: Fri, 7 Feb 2025 08:47:29 +0100 Subject: [PATCH] Funzione per l'input --- Program.cs | 41 ++++++++++++++++-- ...CoreApp,Version=v9.0.AssemblyAttributes.cs | 4 ++ .../net9.0/interrogazione_1.AssemblyInfo.cs | 22 ++++++++++ .../interrogazione_1.AssemblyInfoInputs.cache | 1 + ....GeneratedMSBuildEditorConfig.editorconfig | 15 +++++++ .../net9.0/interrogazione_1.GlobalUsings.g.cs | 8 ++++ .../net9.0/interrogazione_1.assets.cache | Bin 0 -> 149 bytes 7 files changed, 87 insertions(+), 4 deletions(-) create mode 100644 obj/Debug/net9.0/.NETCoreApp,Version=v9.0.AssemblyAttributes.cs create mode 100644 obj/Debug/net9.0/interrogazione_1.AssemblyInfo.cs create mode 100644 obj/Debug/net9.0/interrogazione_1.AssemblyInfoInputs.cache create mode 100644 obj/Debug/net9.0/interrogazione_1.GeneratedMSBuildEditorConfig.editorconfig create mode 100644 obj/Debug/net9.0/interrogazione_1.GlobalUsings.g.cs create mode 100644 obj/Debug/net9.0/interrogazione_1.assets.cache diff --git a/Program.cs b/Program.cs index 314c0b4..3248b34 100644 --- a/Program.cs +++ b/Program.cs @@ -1,9 +1,42 @@ namespace interrogazione_1; -class Program -{ - static void Main(string[] args) - { +class Program { + static void Main(string[] args) { Console.WriteLine("Hello, World!"); } + static int[] Input() { + //dichiarazione e inizializzazione variabili + int dimensione, input = 0, i = 0; + //input della dimensione + do { + Console.Write("Quanti valori vuoi inserire? "); + dimensione = Convert.ToInt32(Console.ReadLine()); + if (dimensione <= 0) { + Console.WriteLine("Dimensione non valida."); + Pausa(); + } + } + while (dimensione <= 0); + + //creazione array + int[] ritorno = new int[dimensione]; + + //Riempimento array + while (i < dimensione || input == Int32.MaxValue) { + Console.Write($"Inserire il valore n. {i}: "); + input = Convert.ToInt32(Console.ReadLine()); + if (input == Int32.MaxValue) { + Console.Write("Valore non valido"); + Pausa(); + } + else { + ritorno[i] = input; + i++; + } + + } + return ritorno; + } + + } 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/interrogazione_1.AssemblyInfo.cs b/obj/Debug/net9.0/interrogazione_1.AssemblyInfo.cs new file mode 100644 index 0000000..7c24426 --- /dev/null +++ b/obj/Debug/net9.0/interrogazione_1.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("interrogazione_1")] +[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+d38856b73cb595d7894423740188b39c6fb3510a")] +[assembly: System.Reflection.AssemblyProductAttribute("interrogazione_1")] +[assembly: System.Reflection.AssemblyTitleAttribute("interrogazione_1")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] + +// Generated by the MSBuild WriteCodeFragment class. + diff --git a/obj/Debug/net9.0/interrogazione_1.AssemblyInfoInputs.cache b/obj/Debug/net9.0/interrogazione_1.AssemblyInfoInputs.cache new file mode 100644 index 0000000..a20834d --- /dev/null +++ b/obj/Debug/net9.0/interrogazione_1.AssemblyInfoInputs.cache @@ -0,0 +1 @@ +5eb9505a53b7be7239957238711ee9d545ae27922a39c4eb40cac9637ffa15ee diff --git a/obj/Debug/net9.0/interrogazione_1.GeneratedMSBuildEditorConfig.editorconfig b/obj/Debug/net9.0/interrogazione_1.GeneratedMSBuildEditorConfig.editorconfig new file mode 100644 index 0000000..ae112d1 --- /dev/null +++ b/obj/Debug/net9.0/interrogazione_1.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 = interrogazione_1 +build_property.ProjectDir = /home/Verde/git/interrogazione_1/ +build_property.EnableComHosting = +build_property.EnableGeneratedComInterfaceComImportInterop = +build_property.EffectiveAnalysisLevelStyle = 9.0 +build_property.EnableCodeStyleSeverity = diff --git a/obj/Debug/net9.0/interrogazione_1.GlobalUsings.g.cs b/obj/Debug/net9.0/interrogazione_1.GlobalUsings.g.cs new file mode 100644 index 0000000..8578f3d --- /dev/null +++ b/obj/Debug/net9.0/interrogazione_1.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/interrogazione_1.assets.cache b/obj/Debug/net9.0/interrogazione_1.assets.cache new file mode 100644 index 0000000000000000000000000000000000000000..a0574ad89ec1d4e6fc6806cd3e5e8ca2ccf6ed7a GIT binary patch literal 149 zcmWIWc6a1qU|_JYaLQsi`sUQj$9~KGy~TKU2A5pH;32l$i9j{P0!E-h k8U2j>+*JLr)S{GBeZ9QW^wbjlg2d$P#Prl+eL@BS0PGSPeE