Nuova aggiunta voce
This commit is contained in:
parent
ba3db65a52
commit
7134c6d495
15
Program.cs
15
Program.cs
@ -8,9 +8,8 @@ class Program {
|
|||||||
int scelta = 0;
|
int scelta = 0;
|
||||||
string nome = "";
|
string nome = "";
|
||||||
string numeroditelefono;
|
string numeroditelefono;
|
||||||
bool rubricaEsiste = false;
|
bool rubricaNonVuota = false;
|
||||||
bool error;
|
bool error;
|
||||||
bool check3 = false;
|
|
||||||
int contatore = 0;
|
int contatore = 0;
|
||||||
string nomeesatto;
|
string nomeesatto;
|
||||||
string nomeapprossimato;
|
string nomeapprossimato;
|
||||||
@ -67,15 +66,13 @@ class Program {
|
|||||||
}
|
}
|
||||||
while (error);
|
while (error);
|
||||||
|
|
||||||
singolavoce = new Voce(nome, numeroditelefono);
|
rubrica.AddVocidellarubrica(new Voce(nome, numeroditelefono));
|
||||||
voci[contatore] = singolavoce;
|
|
||||||
rubrica = new Rubrica(voci);
|
|
||||||
contatore++;
|
contatore++;
|
||||||
rubricaEsiste = true;
|
rubricaNonVuota = true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (rubricaEsiste == false) {
|
if (rubricaNonVuota == false) {
|
||||||
Console.WriteLine("devi prima aggiungere una voce in rubrica");
|
Console.WriteLine("devi prima aggiungere una voce in rubrica");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -98,7 +95,7 @@ class Program {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (rubricaEsiste == false) {
|
if (rubricaNonVuota == false) {
|
||||||
Console.WriteLine("devi prima aggiungere una voce in rubrica");
|
Console.WriteLine("devi prima aggiungere una voce in rubrica");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -120,7 +117,7 @@ class Program {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
if (rubricaEsiste == false) {
|
if (rubricaNonVuota == false) {
|
||||||
Console.WriteLine("devi prima aggiungere una voce in rubrica");
|
Console.WriteLine("devi prima aggiungere una voce in rubrica");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@ -14,6 +14,13 @@ class Rubrica {
|
|||||||
return this.vocidellarubrica;
|
return this.vocidellarubrica;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AddVocidellarubrica(Voce p_nuovaVoce) {
|
||||||
|
Voce[] oldRubrica = this.vocidellarubrica;
|
||||||
|
Voce[] newRubrica = new Voce[oldRubrica.Length + 1];
|
||||||
|
Array.Copy(oldRubrica, newRubrica, oldRubrica.Length);
|
||||||
|
newRubrica[oldRubrica.Length] = p_nuovaVoce;
|
||||||
|
this.vocidellarubrica = newRubrica;
|
||||||
|
}
|
||||||
public string Ricerca(string p_ricerca, bool p_tipologia, int p_contatore) {
|
public string Ricerca(string p_ricerca, bool p_tipologia, int p_contatore) {
|
||||||
/*
|
/*
|
||||||
p_tipologia=true -> ricerca esatta
|
p_tipologia=true -> ricerca esatta
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user