diff --git a/Program.cs b/Program.cs index 824e56e..24121bd 100644 --- a/Program.cs +++ b/Program.cs @@ -1,7 +1,6 @@ namespace vacanzeEstive_sezione2; -class Program -{ +class Program { static void Main(string[] args) { Console.Clear(); int scelta = -1; @@ -18,6 +17,7 @@ class Program case 0: break; case 1: + CreaMatrice(); Pausa(); break; default: @@ -40,4 +40,77 @@ class Program Console.WriteLine("Premere un tasto per continuare. . ."); Console.ReadKey(); } + + static int[,] CreaMatrice() { + uint righe = 0, colonne = 0; + bool error; + + do { + error = false; + Console.Write("Inserire il numero di righe della matrice: "); + + try { + righe = Convert.ToUInt32(Console.ReadLine()); + if (righe < 1) { + error = true; + Console.WriteLine("Errore: non sono ammesse dimensioni inferiori a 2."); + Pausa(); + } + } + catch (FormatException) { + error = true; + Console.WriteLine("Errore: dimensione non valida."); + Pausa(); + } + catch (OverflowException) { + error = true; + Console.WriteLine("Errore: non sono ammesse dimensioni negative."); + Pausa(); + } + } while (error); + + do { + error = false; + Console.Write("Inserire il numero di colonne della matrice: "); + + try { + colonne = Convert.ToUInt32(Console.ReadLine()); + if (colonne < 1) { + error = true; + Console.WriteLine("Errore: non sono ammesse dimensioni inferiori a 2."); + Pausa(); + } + } + catch (FormatException) { + error = true; + Console.WriteLine("Errore: dimensione non valida."); + Pausa(); + } + catch (OverflowException) { + error = true; + Console.WriteLine("Errore: non sono ammesse dimensioni negative."); + Pausa(); + } + } while (error); + + return RiempiMatrice(new int[righe, colonne]); + } + + static int[,] RiempiMatrice(int[,] p_matrix) { + int elemento; + for (int r = 0; r < p_matrix.GetLength(0); r++) { + for (int c = 0; c < p_matrix.GetLength(1); c++) { + Console.Write($"Inserire l'elemento in posizione {r},{c}: "); + try { + elemento = Convert.ToInt32(Console.ReadLine()); + } + catch (FormatException) { + Console.WriteLine("Errore: elemento non valido."); + Pausa(); + } + } + } + + return p_matrix; + } } diff --git a/bin/Debug/net9.0/vacanzeEstive_sezione2 b/bin/Debug/net9.0/vacanzeEstive_sezione2 new file mode 100755 index 0000000..ebc848f Binary files /dev/null and b/bin/Debug/net9.0/vacanzeEstive_sezione2 differ diff --git a/bin/Debug/net9.0/vacanzeEstive_sezione2.deps.json b/bin/Debug/net9.0/vacanzeEstive_sezione2.deps.json new file mode 100644 index 0000000..aa43604 --- /dev/null +++ b/bin/Debug/net9.0/vacanzeEstive_sezione2.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v9.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v9.0": { + "vacanzeEstive_sezione2/1.0.0": { + "runtime": { + "vacanzeEstive_sezione2.dll": {} + } + } + } + }, + "libraries": { + "vacanzeEstive_sezione2/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/bin/Debug/net9.0/vacanzeEstive_sezione2.dll b/bin/Debug/net9.0/vacanzeEstive_sezione2.dll new file mode 100644 index 0000000..44383c7 Binary files /dev/null and b/bin/Debug/net9.0/vacanzeEstive_sezione2.dll differ diff --git a/bin/Debug/net9.0/vacanzeEstive_sezione2.pdb b/bin/Debug/net9.0/vacanzeEstive_sezione2.pdb new file mode 100644 index 0000000..4ed4062 Binary files /dev/null and b/bin/Debug/net9.0/vacanzeEstive_sezione2.pdb differ diff --git a/bin/Debug/net9.0/vacanzeEstive_sezione2.runtimeconfig.json b/bin/Debug/net9.0/vacanzeEstive_sezione2.runtimeconfig.json new file mode 100644 index 0000000..b19c3c8 --- /dev/null +++ b/bin/Debug/net9.0/vacanzeEstive_sezione2.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/apphost b/obj/Debug/net9.0/apphost new file mode 100755 index 0000000..ebc848f Binary files /dev/null and b/obj/Debug/net9.0/apphost differ diff --git a/obj/Debug/net9.0/ref/vacanzeEstive_sezione2.dll b/obj/Debug/net9.0/ref/vacanzeEstive_sezione2.dll new file mode 100644 index 0000000..815fe1e Binary files /dev/null and b/obj/Debug/net9.0/ref/vacanzeEstive_sezione2.dll differ diff --git a/obj/Debug/net9.0/refint/vacanzeEstive_sezione2.dll b/obj/Debug/net9.0/refint/vacanzeEstive_sezione2.dll new file mode 100644 index 0000000..815fe1e Binary files /dev/null and b/obj/Debug/net9.0/refint/vacanzeEstive_sezione2.dll differ diff --git a/obj/Debug/net9.0/vacanzeEstive_sezione2.AssemblyInfo.cs b/obj/Debug/net9.0/vacanzeEstive_sezione2.AssemblyInfo.cs index 4031e56..e65c2b4 100644 --- a/obj/Debug/net9.0/vacanzeEstive_sezione2.AssemblyInfo.cs +++ b/obj/Debug/net9.0/vacanzeEstive_sezione2.AssemblyInfo.cs @@ -13,10 +13,10 @@ using System.Reflection; [assembly: System.Reflection.AssemblyCompanyAttribute("vacanzeEstive_sezione2")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0f979af2d96a8dff513ac6474c5c8e3c7bcd1fb5")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+cafc48ce6407bf16c0d16b4fde5ee8673539a6ca")] [assembly: System.Reflection.AssemblyProductAttribute("vacanzeEstive_sezione2")] [assembly: System.Reflection.AssemblyTitleAttribute("vacanzeEstive_sezione2")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] -// Generated by the MSBuild WriteCodeFragment class. +// Generato dalla classe WriteCodeFragment di MSBuild. diff --git a/obj/Debug/net9.0/vacanzeEstive_sezione2.AssemblyInfoInputs.cache b/obj/Debug/net9.0/vacanzeEstive_sezione2.AssemblyInfoInputs.cache index ebbbbcf..ea7a29c 100644 --- a/obj/Debug/net9.0/vacanzeEstive_sezione2.AssemblyInfoInputs.cache +++ b/obj/Debug/net9.0/vacanzeEstive_sezione2.AssemblyInfoInputs.cache @@ -1 +1 @@ -220dabe602bbe8b64032d5752b075c9dcd5ebdb82403a4a7ecfe7e3d7b268563 +f51dd8e398f51ce3006057d64eb8817f1c96774015caa399a7ccd91231d29a3e diff --git a/obj/Debug/net9.0/vacanzeEstive_sezione2.csproj.CoreCompileInputs.cache b/obj/Debug/net9.0/vacanzeEstive_sezione2.csproj.CoreCompileInputs.cache new file mode 100644 index 0000000..6bbc67a --- /dev/null +++ b/obj/Debug/net9.0/vacanzeEstive_sezione2.csproj.CoreCompileInputs.cache @@ -0,0 +1 @@ +4ed8f9bada649f86edd5892680ac069d0771e049f4facf85f62be400d2283e5f diff --git a/obj/Debug/net9.0/vacanzeEstive_sezione2.csproj.FileListAbsolute.txt b/obj/Debug/net9.0/vacanzeEstive_sezione2.csproj.FileListAbsolute.txt new file mode 100644 index 0000000..579d5fa --- /dev/null +++ b/obj/Debug/net9.0/vacanzeEstive_sezione2.csproj.FileListAbsolute.txt @@ -0,0 +1,14 @@ +/home/Verde/git/vacanzeEstive_sezione2/bin/Debug/net9.0/vacanzeEstive_sezione2 +/home/Verde/git/vacanzeEstive_sezione2/bin/Debug/net9.0/vacanzeEstive_sezione2.deps.json +/home/Verde/git/vacanzeEstive_sezione2/bin/Debug/net9.0/vacanzeEstive_sezione2.runtimeconfig.json +/home/Verde/git/vacanzeEstive_sezione2/bin/Debug/net9.0/vacanzeEstive_sezione2.dll +/home/Verde/git/vacanzeEstive_sezione2/bin/Debug/net9.0/vacanzeEstive_sezione2.pdb +/home/Verde/git/vacanzeEstive_sezione2/obj/Debug/net9.0/vacanzeEstive_sezione2.GeneratedMSBuildEditorConfig.editorconfig +/home/Verde/git/vacanzeEstive_sezione2/obj/Debug/net9.0/vacanzeEstive_sezione2.AssemblyInfoInputs.cache +/home/Verde/git/vacanzeEstive_sezione2/obj/Debug/net9.0/vacanzeEstive_sezione2.AssemblyInfo.cs +/home/Verde/git/vacanzeEstive_sezione2/obj/Debug/net9.0/vacanzeEstive_sezione2.csproj.CoreCompileInputs.cache +/home/Verde/git/vacanzeEstive_sezione2/obj/Debug/net9.0/vacanzeEstive_sezione2.dll +/home/Verde/git/vacanzeEstive_sezione2/obj/Debug/net9.0/refint/vacanzeEstive_sezione2.dll +/home/Verde/git/vacanzeEstive_sezione2/obj/Debug/net9.0/vacanzeEstive_sezione2.pdb +/home/Verde/git/vacanzeEstive_sezione2/obj/Debug/net9.0/vacanzeEstive_sezione2.genruntimeconfig.cache +/home/Verde/git/vacanzeEstive_sezione2/obj/Debug/net9.0/ref/vacanzeEstive_sezione2.dll diff --git a/obj/Debug/net9.0/vacanzeEstive_sezione2.dll b/obj/Debug/net9.0/vacanzeEstive_sezione2.dll new file mode 100644 index 0000000..44383c7 Binary files /dev/null and b/obj/Debug/net9.0/vacanzeEstive_sezione2.dll differ diff --git a/obj/Debug/net9.0/vacanzeEstive_sezione2.genruntimeconfig.cache b/obj/Debug/net9.0/vacanzeEstive_sezione2.genruntimeconfig.cache new file mode 100644 index 0000000..8762fc1 --- /dev/null +++ b/obj/Debug/net9.0/vacanzeEstive_sezione2.genruntimeconfig.cache @@ -0,0 +1 @@ +034bd2f866258b263178a67151a5d92c9c02f7ff937c4d945fbe2ecc12c6ae25 diff --git a/obj/Debug/net9.0/vacanzeEstive_sezione2.pdb b/obj/Debug/net9.0/vacanzeEstive_sezione2.pdb new file mode 100644 index 0000000..4ed4062 Binary files /dev/null and b/obj/Debug/net9.0/vacanzeEstive_sezione2.pdb differ