Formattazione
This commit is contained in:
parent
94dc22499c
commit
85edf42d52
33
Program.cs
33
Program.cs
@ -9,7 +9,8 @@ class Program
|
|||||||
int scelta;
|
int scelta;
|
||||||
int[] array = null;
|
int[] array = null;
|
||||||
|
|
||||||
do{
|
do
|
||||||
|
{
|
||||||
Console.WriteLine("Scegliere un'opzione:");
|
Console.WriteLine("Scegliere un'opzione:");
|
||||||
Console.WriteLine("1. Crea un'insieme di numeri tra " + minDimensione + " e " + maxDimensione);
|
Console.WriteLine("1. Crea un'insieme di numeri tra " + minDimensione + " e " + maxDimensione);
|
||||||
Console.WriteLine("2. Mostra il maggiore e il minore");
|
Console.WriteLine("2. Mostra il maggiore e il minore");
|
||||||
@ -19,7 +20,8 @@ class Program
|
|||||||
scelta = Convert.ToInt32(Console.ReadLine());
|
scelta = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
|
|
||||||
switch (scelta){
|
switch (scelta)
|
||||||
|
{
|
||||||
case 0:
|
case 0:
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
break;
|
break;
|
||||||
@ -50,18 +52,22 @@ class Program
|
|||||||
while (scelta != 0);
|
while (scelta != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void Pausa(){
|
static void Pausa()
|
||||||
|
{
|
||||||
Console.WriteLine("Premere invio per continuare. . .");
|
Console.WriteLine("Premere invio per continuare. . .");
|
||||||
Console.ReadLine();
|
Console.ReadLine();
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
}
|
}
|
||||||
static int[] CreaArray(){
|
static int[] CreaArray()
|
||||||
|
{
|
||||||
int dimensione, input, i = 0;
|
int dimensione, input, i = 0;
|
||||||
|
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
Console.Write("Quanti numeri vuoi inserire? ");
|
Console.Write("Quanti numeri vuoi inserire? ");
|
||||||
dimensione = Convert.ToInt32(Console.ReadLine());
|
dimensione = Convert.ToInt32(Console.ReadLine());
|
||||||
if (dimensione <= 0) {
|
if (dimensione <= 0)
|
||||||
|
{
|
||||||
Console.WriteLine("Devi inserire almeno un numero");
|
Console.WriteLine("Devi inserire almeno un numero");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,18 +75,21 @@ class Program
|
|||||||
|
|
||||||
int[] ritorno = new int[dimensione];
|
int[] ritorno = new int[dimensione];
|
||||||
|
|
||||||
do{
|
do
|
||||||
|
{
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
Console.WriteLine("Hai ancora " + (dimensione - i) + " numeri da inserire");
|
Console.WriteLine("Hai ancora " + (dimensione - i) + " numeri da inserire");
|
||||||
Console.Write("Inserire un numero: ");
|
Console.Write("Inserire un numero: ");
|
||||||
|
|
||||||
input = Convert.ToInt32(Console.ReadLine());
|
input = Convert.ToInt32(Console.ReadLine());
|
||||||
|
|
||||||
if(input>=minDimensione && input<=maxDimensione){
|
if (input >= minDimensione && input <= maxDimensione)
|
||||||
|
{
|
||||||
ritorno[i] = input;
|
ritorno[i] = input;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
else{
|
else
|
||||||
|
{
|
||||||
Console.WriteLine("Il numero deve essere compreso tra 0 e 100, estremi inclusi");
|
Console.WriteLine("Il numero deve essere compreso tra 0 e 100, estremi inclusi");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -88,8 +97,10 @@ class Program
|
|||||||
|
|
||||||
return ritorno;
|
return ritorno;
|
||||||
}
|
}
|
||||||
static void StampaArray(int [] p_insieme) {
|
static void StampaArray(int[] p_insieme)
|
||||||
for (int j=0; j<p_insieme.Length; j++){
|
{
|
||||||
|
for (int j = 0; j < p_insieme.Length; j++)
|
||||||
|
{
|
||||||
Console.WriteLine("Elemento " + j + ": " + p_insieme[j]);
|
Console.WriteLine("Elemento " + j + ": " + p_insieme[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,10 +13,10 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("ripasso3")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("ripasso3")]
|
||||||
[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+15c72c296c74744698fec0074b8acd25a1dfc2e1")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+94dc22499cbe7af1d6ae1ae95f7371787302b5d2")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("ripasso3")]
|
[assembly: System.Reflection.AssemblyProductAttribute("ripasso3")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("ripasso3")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("ripasso3")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|
||||||
// Generated by the MSBuild WriteCodeFragment class.
|
// Generato dalla classe WriteCodeFragment di MSBuild.
|
||||||
|
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
6705cc8617ec0c97465be09ce2330e1b3ccd4f7d2b8aa37d1fbe52005a4aff45
|
fe71cb23789e00a289963d8315807f2b2cd76aed087e41fa45dd9fe64b91c300
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user