Conforme alla traccia
This commit is contained in:
parent
69f8fc5130
commit
3a5066b2f3
21
Program.cs
21
Program.cs
@ -11,20 +11,37 @@ class Program
|
|||||||
}
|
}
|
||||||
static int Dimensione(){
|
static int Dimensione(){
|
||||||
int ritorno;
|
int ritorno;
|
||||||
|
const int max = 100000;
|
||||||
do {
|
do {
|
||||||
Console.Write("Quanto grande deve essere l'array? ");
|
Console.Write("Quanto grande deve essere l'array? ");
|
||||||
ritorno = Convert.ToInt32(Console.ReadLine());
|
ritorno = Convert.ToInt32(Console.ReadLine());
|
||||||
if (ritorno <= 1) {
|
if (ritorno <= 1) {
|
||||||
Console.WriteLine("L'array deve avere una dimensione maggiore di uno");
|
Console.WriteLine("L'array deve avere una dimensione maggiore di uno");
|
||||||
}
|
}
|
||||||
|
else if(ritorno>max){
|
||||||
|
Console.WriteLine("L'array non può avere più di " + max + " elementi");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (ritorno <= 1);
|
while (ritorno <= 1);
|
||||||
return ritorno;
|
return ritorno;
|
||||||
}
|
}
|
||||||
static void InserimentoValoriArray(int[] p_array){
|
static void InserimentoValoriArray(int[] p_array){
|
||||||
for (int i=0; i<p_array.Length;i++){
|
int input, i = 9;
|
||||||
|
const int min = 1;
|
||||||
|
const int max = 1000000000;
|
||||||
|
while (i<p_array.Length){
|
||||||
Console.Write("Inserire il " + (i + 1) + "° numero: ");
|
Console.Write("Inserire il " + (i + 1) + "° numero: ");
|
||||||
p_array[i] = Convert.ToInt32(Console.ReadLine());
|
input = Convert.ToInt32(Console.ReadLine());
|
||||||
|
if(input<min){
|
||||||
|
Console.WriteLine("Il numero non può essere inferiore a " + min);
|
||||||
|
}
|
||||||
|
else if(input>max){
|
||||||
|
Console.WriteLine("Il numero non può essere superiore a " + max);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
p_array[i] = input;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void ScambioValoreMinimo(int[] p_array){
|
static void ScambioValoreMinimo(int[] p_array){
|
||||||
|
|||||||
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("sorting_proximity")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("sorting_proximity")]
|
||||||
[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+9164a62f9e443a5a7ccbe17b05930889bd2c2776")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+69f8fc5130a5bd17d19c16c75c10c21cbd3f6549")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("sorting_proximity")]
|
[assembly: System.Reflection.AssemblyProductAttribute("sorting_proximity")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("sorting_proximity")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("sorting_proximity")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
c22826eab3b2e5493e6d270aec65243f5dd384d61e47a0c286073aa07b67762a
|
6433006b6b2ca249efc98ebb4214441da7035b0f435f3f4418a9f447e0c618e3
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user