Rispetta la traccia(?)
This commit is contained in:
parent
8b7f1ccfb2
commit
a42bda57e1
25
Program.cs
25
Program.cs
@ -6,15 +6,20 @@ class Program
|
|||||||
{
|
{
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
//dichiarazione e inizializzazione variabili
|
//dichiarazione e inizializzazione variabili
|
||||||
int scelta=4, numero=0, divisore=13;
|
int scelta=4, numero=0;
|
||||||
uint dimensione=20, zeri=0;
|
uint zeri=0; //supporto per verificare se sono state eseguite le voci 1 e 2
|
||||||
|
const uint dimensione=20;
|
||||||
const int costante1 = 2;
|
const int costante1 = 2;
|
||||||
const int costante2 = 3;
|
const int costante2 = 3;
|
||||||
|
const uint divisore=13;
|
||||||
int[] array1= new int[dimensione];
|
int[] array1= new int[dimensione];
|
||||||
int[] array2= new int[dimensione];
|
int[] array2= new int[dimensione];
|
||||||
int[] array3= new int[dimensione*2];
|
int[] array3= new int[dimensione*2];
|
||||||
bool nonsvolto1=true, nonsvolto2=true;
|
bool nonsvolto1=true, nonsvolto2=true;
|
||||||
|
for(int i=0; i<dimensione; i++){//riempio gli array di zero (anche se sono già pieni di zero ma non si sa mai)
|
||||||
|
array1[i] = 0;
|
||||||
|
array2[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
//menù
|
//menù
|
||||||
do{
|
do{
|
||||||
@ -82,6 +87,8 @@ class Program
|
|||||||
Console.Clear();
|
Console.Clear();
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
|
Console.WriteLine("Debug nonsvolto1: " +nonsvolto1);
|
||||||
|
Console.WriteLine("Debug nonsvolto2: " +nonsvolto2);
|
||||||
Console.Clear();
|
Console.Clear();
|
||||||
//condizione per verificare se è stata usata la voce 1
|
//condizione per verificare se è stata usata la voce 1
|
||||||
for(int i=0; i<array1.Length; i++){
|
for(int i=0; i<array1.Length; i++){
|
||||||
@ -89,6 +96,7 @@ class Program
|
|||||||
zeri++;
|
zeri++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Console.WriteLine("Debug zeri: " +zeri);
|
||||||
|
|
||||||
if(zeri==array1.Length){//se tutte le celle sono zero allora la voce 1 non è stata usata
|
if(zeri==array1.Length){//se tutte le celle sono zero allora la voce 1 non è stata usata
|
||||||
nonsvolto1=true;
|
nonsvolto1=true;
|
||||||
@ -96,6 +104,9 @@ class Program
|
|||||||
else{
|
else{
|
||||||
nonsvolto1=false;
|
nonsvolto1=false;
|
||||||
}
|
}
|
||||||
|
Console.WriteLine("Debug nonsvolto1: " +nonsvolto1);
|
||||||
|
|
||||||
|
zeri=0;//reset della variabile zeri
|
||||||
|
|
||||||
//condizione per verificare se è stata usata la voce 2
|
//condizione per verificare se è stata usata la voce 2
|
||||||
for(int i=0; i<array2.Length; i++){
|
for(int i=0; i<array2.Length; i++){
|
||||||
@ -104,12 +115,16 @@ class Program
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(zeri==array2.Length){//se tutte le celle sono zero allora la voce 1 non è stata usata
|
if(zeri==array2.Length){//se tutte le celle sono zero allora la voce 2 non è stata usata
|
||||||
nonsvolto2=true;
|
nonsvolto2=true;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
nonsvolto2=false;
|
nonsvolto2=false;
|
||||||
}
|
}
|
||||||
|
Console.WriteLine("Debug nonsvolto2: " +nonsvolto2);
|
||||||
|
Console.WriteLine("Debug zeri: " +zeri);
|
||||||
|
zeri=0;//reset della variabile zeri
|
||||||
|
|
||||||
switch((nonsvolto1, nonsvolto2)) {
|
switch((nonsvolto1, nonsvolto2)) {
|
||||||
case (true,true):
|
case (true,true):
|
||||||
Console.WriteLine("Eseguire le altre voci prima di selezionare questa");
|
Console.WriteLine("Eseguire le altre voci prima di selezionare questa");
|
||||||
@ -128,7 +143,7 @@ class Program
|
|||||||
array3[i+array1.Length]=array2[i]*costante2;
|
array3[i+array1.Length]=array2[i]*costante2;
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.Clear();
|
//Console.Clear();
|
||||||
|
|
||||||
Console.WriteLine("I numeri inseriti sono: ");
|
Console.WriteLine("I numeri inseriti sono: ");
|
||||||
for(int i=0; i<array3.Length; i++){
|
for(int i=0; i<array3.Length; i++){
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@ -13,7 +13,7 @@ using System.Reflection;
|
|||||||
[assembly: System.Reflection.AssemblyCompanyAttribute("array_2")]
|
[assembly: System.Reflection.AssemblyCompanyAttribute("array_2")]
|
||||||
[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+e303acca00d47044d34622bcee693979f52fc47e")]
|
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+8b7f1ccfb2d6a8fdf4e2c0fc5c805e71bd8e7dfb")]
|
||||||
[assembly: System.Reflection.AssemblyProductAttribute("array_2")]
|
[assembly: System.Reflection.AssemblyProductAttribute("array_2")]
|
||||||
[assembly: System.Reflection.AssemblyTitleAttribute("array_2")]
|
[assembly: System.Reflection.AssemblyTitleAttribute("array_2")]
|
||||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
4370a22d55f257d59f51019469d1c1647c4fa3791d529d8e67938944679b0197
|
c91801565e9dd237809c947746c063cad393b4b135cef8e18e6e4dbcbd54dceb
|
||||||
|
|||||||
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