Mezza opzione 10
This commit is contained in:
parent
5550fe97d5
commit
2558982c05
60
Program.cs
60
Program.cs
@ -40,6 +40,7 @@ class Program
|
||||
for (int j=0; j<dimensione*2; j++){
|
||||
insiemeDoppio[j]=0;
|
||||
}
|
||||
|
||||
int[] insieme2=new int[dimensione];
|
||||
for (int j=0; j<dimensione; j++){
|
||||
insieme2[j]=0;
|
||||
@ -55,6 +56,11 @@ class Program
|
||||
intersezione[j]=0;
|
||||
}
|
||||
|
||||
int[] insiemeTriplo=new int[dimensione*3];
|
||||
for (int j=0; j<dimensione*3; j++){
|
||||
insiemeTriplo[j]=0;
|
||||
}
|
||||
|
||||
|
||||
//menù
|
||||
do{
|
||||
@ -359,7 +365,61 @@ class Program
|
||||
Pausa();
|
||||
break;
|
||||
case 10:
|
||||
//reset variabili
|
||||
for (int j=0; j<dimensione; j++){
|
||||
insieme2[j]=0;
|
||||
}
|
||||
for (int j=0; j<dimensione; j++){
|
||||
insieme3[j]=0;
|
||||
}
|
||||
for (int j=0; j<dimensione*2; j++){
|
||||
insiemeDoppio[j]=0;
|
||||
}
|
||||
i=0;
|
||||
|
||||
Console.Clear();
|
||||
Console.WriteLine("Insieme 1");
|
||||
do{
|
||||
Console.Write("Inserire un numero, massimo " +dimensione+ " numeri ([q] per uscire): ");
|
||||
input=Console.ReadLine(); //non posso ancora fare il catch dell'eccezione se viene inserito un qualcosa che non sia un numero o q
|
||||
if (input!="q"){
|
||||
insieme2[i]=Convert.ToInt32(input);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
while (input!="q" && i<dimensione);
|
||||
Console.Clear();
|
||||
//reset contatore
|
||||
i=0;
|
||||
Console.WriteLine("Insieme 2");
|
||||
do{
|
||||
Console.Write("Inserire un numero, massimo " +dimensione*2+ " numeri ([q] per uscire): ");
|
||||
input=Console.ReadLine(); //non posso ancora fare il catch dell'eccezione se viene inserito un qualcosa che non sia un numero o q
|
||||
if (input!="q"){
|
||||
insiemeDoppio[i]=Convert.ToInt32(input);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
while (input!="q" && i<dimensione*2);
|
||||
Console.Clear();
|
||||
|
||||
i=0;
|
||||
for(int j=0; j<dimensione*2; j++){
|
||||
if(j%2!=0){
|
||||
insiemeTriplo[j]=insiemeDoppio[i];
|
||||
i++;
|
||||
}
|
||||
else{
|
||||
insiemeTriplo[j]=insieme2[i];
|
||||
}
|
||||
}
|
||||
Console.WriteLine("i: " +i);
|
||||
for(int j=0; i<dimensione; j++){
|
||||
insiemeTriplo[dimensione+j]=insiemeDoppio[i];
|
||||
i++;
|
||||
}
|
||||
StampaArray(insiemeTriplo);
|
||||
Pausa();
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Scelta non valida");
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("array_funzioni")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f2e9a0b37c9712006e9a18365fabbcbd05c5c434")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+5550fe97d55be94e738ce8c3cf4a9dfc14391aab")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("array_funzioni")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("array_funzioni")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@ -1 +1 @@
|
||||
6ecad56f5838988e9cad5c169cc1ea2ab00bf0e894c4aec7eaac85c717b78a82
|
||||
4c7fde40aa9590eb6e46f6c3df76313ded3d5322caad874ec534ac81c51140a1
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user