Prototipo opzione 2
This commit is contained in:
parent
122704cb76
commit
5e25bae12b
37
Program.cs
37
Program.cs
@ -92,5 +92,42 @@ class Program {
|
|||||||
}
|
}
|
||||||
return ritorno;
|
return ritorno;
|
||||||
}
|
}
|
||||||
|
static void CreaVettoriParalleli() {
|
||||||
|
string nome, cognome;
|
||||||
|
string[] arrayNomi = new string [dimensione], arrayCognomi = new string [dimensione];
|
||||||
|
char scelta;
|
||||||
|
|
||||||
|
for (int i = 0; i< dimensione; i++){
|
||||||
|
do {
|
||||||
|
Console.Write("Inserire il nome dell'alunno n." + (i + 1) + ": ");
|
||||||
|
nome = Console.ReadLine();
|
||||||
|
|
||||||
|
Console.WriteLine("Nome inserito: " + nome);
|
||||||
|
do{
|
||||||
|
Console.Write("È corretto? [S/N]");
|
||||||
|
scelta = Convert.ToChar(Console.ReadLine());
|
||||||
|
switch(scelta){
|
||||||
|
case 'S':
|
||||||
|
arrayNomi[i] = nome;
|
||||||
|
break;
|
||||||
|
case 'N':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Console.WriteLine("Opzione non valida, inserire [S] o [N]");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (scelta != 'S' && scelta != 'N');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
while (true);
|
||||||
|
Console.Write("Inserire il cognome dell'alunno n." + (i +1) + ": ");
|
||||||
|
cognome = Console.ReadLine();
|
||||||
|
Console.WriteLine("Cognome inserito: " + cognome);
|
||||||
|
arrayCognomi[i]= cognome;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user