Opzione 7

This commit is contained in:
La Programmatrice Verde 2025-03-12 09:32:07 +01:00
parent 539f1a7b8c
commit 764a338306
9 changed files with 16 additions and 29 deletions

View File

@ -20,7 +20,7 @@ class Program {
Console.WriteLine("4. Prodotto diagonale secondaria"); Console.WriteLine("4. Prodotto diagonale secondaria");
Console.WriteLine("5. Valore minimo e massimo diagonale secondaria"); Console.WriteLine("5. Valore minimo e massimo diagonale secondaria");
Console.WriteLine("6. Somma 2 matrici"); Console.WriteLine("6. Somma 2 matrici");
Console.WriteLine("7. MOstra matrice trasposta"); Console.WriteLine("7. Mostra matrice trasposta");
Console.WriteLine("0. Esci"); Console.WriteLine("0. Esci");
Console.Write("Scelta: "); Console.Write("Scelta: ");
scelta = Convert.ToInt32(Console.ReadLine()); scelta = Convert.ToInt32(Console.ReadLine());
@ -91,33 +91,10 @@ class Program {
break; break;
case 7: case 7:
Console.Clear(); Console.Clear();
if (matrix1 != null) { matrix1 = CreaMatrice();
if (true) {
Console.WriteLine("Sulla diagonale principale sono presenti degli zeri");
}
else {
Console.WriteLine("Sulla diagonale principale non sono presenti degli zeri");
}
}
else {
Console.WriteLine("È necessario creare la matrice prima di cercare gli zeri sulla diagonale principale.");
}
Pausa();
break;
case 8:
Console.Clear(); Console.Clear();
if (matrix1 != null) { Console.WriteLine("La matrice trasposta è");
Console.Write("Inserire un numero da cercare: "); MostraMatrice(CreaTrasposta(matrix1));
if (true) {
Console.WriteLine("Elemento trovato");
}
else {
Console.WriteLine("Elemento non trovato");
}
}
else {
Console.WriteLine("È necessario creare la matrice prima di cercare un elemento sulla diagonale principale.");
}
Pausa(); Pausa();
break; break;
default: default:
@ -274,4 +251,14 @@ class Program {
} }
return ritorno; return ritorno;
} }
static int[,] CreaTrasposta(int[,] p_matrice) {
int[,] ritorno = new int[p_matrice.GetLength(0), p_matrice.GetLength(1)];
for (int r = 0; r < p_matrice.GetLength(0); r++) {
for (int c = 0; c < p_matrice.GetLength(1); c++) {
ritorno[r, c] = p_matrice[c, r];
}
}
return ritorno;
}
} }

Binary file not shown.

Binary file not shown.

View File

@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("matrix_3")] [assembly: System.Reflection.AssemblyCompanyAttribute("matrix_3")]
[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+b00a9cea811f930eff832555c7d39711548491f2")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+539f1a7b8c9a68722f7a1fe86ab352245f0386bf")]
[assembly: System.Reflection.AssemblyProductAttribute("matrix_3")] [assembly: System.Reflection.AssemblyProductAttribute("matrix_3")]
[assembly: System.Reflection.AssemblyTitleAttribute("matrix_3")] [assembly: System.Reflection.AssemblyTitleAttribute("matrix_3")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@ -1 +1 @@
24011d8278f0ee5fff0d76f8ca60ae6d36888403cf7bf503a41a322503a8e8e7 75d0e1c096fd43eafc2a6b5b20efe325c46b0abfa9de25105e4bd04279227414

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.