Migliorato il ciclo di stampe finale
This commit is contained in:
parent
e1bdc5ce81
commit
a90a339036
11
Program.cs
11
Program.cs
@ -35,7 +35,7 @@ class Program {
|
||||
//dichiarazione e inizializzazione variabili
|
||||
int[] elementi = new int[p_array.Length];
|
||||
int[] occorrenze = new int[p_array.Length];
|
||||
int temp = Int32.MaxValue, occorrenza;
|
||||
int temp = Int32.MaxValue, occorrenza, k = 0;
|
||||
bool incontrato = false;
|
||||
|
||||
for (int i = 0; i < p_array.Length; i++) {//riempio gli array con un valore non inseribile per poi effettuare la stampa
|
||||
@ -68,10 +68,9 @@ class Program {
|
||||
}
|
||||
|
||||
//mostro i risultati
|
||||
for (int i = 0; i < p_array.Length; i++) {
|
||||
if (elementi[i] != Int32.MaxValue && occorrenze[i] != Int32.MaxValue) { //mostro tutti gli elementi e le occorrenze che non siano il valore che ho escluso
|
||||
Console.WriteLine($"L'elemento {elementi[i]} ricorre {occorrenze[i]} volte");
|
||||
}
|
||||
while (elementi[k] != Int32.MaxValue && occorrenze[k] != Int32.MaxValue) { //mostro tutti gli elementi e le occorrenze che non siano il valore che ho escluso
|
||||
Console.WriteLine($"L'elemento {elementi[i]} ricorre {occorrenze[i]} volte");
|
||||
k++;
|
||||
}
|
||||
|
||||
}
|
||||
@ -81,4 +80,4 @@ class Program {
|
||||
Console.ReadKey();
|
||||
Console.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -13,7 +13,7 @@ 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+375e8e313894d1ba85f5e83e75b8613a2e55c56d")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+e1bdc5ce81634d8f8c3e53e5342e4f6f08f3d475")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("interrogazione_1")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("interrogazione_1")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@ -1 +1 @@
|
||||
2e6c6a3c5d7e586e8470a2be6f7df96156c47b9355983c88595a6e9d2d51c521
|
||||
7c90a0001a13ebd2892e94c7cede170ef6176ad566914e0988bc9ff3361d4cf0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user