Importata funzione per la codifica
This commit is contained in:
parent
5e881acf6b
commit
70e2bb324b
31
Program.cs
31
Program.cs
@ -111,4 +111,35 @@ class Program {
|
||||
return p_array[maxIndex];
|
||||
|
||||
}
|
||||
|
||||
static string Codifica() {
|
||||
string stringa = Input();
|
||||
char codice = 'f';
|
||||
const char inutile = '\\';
|
||||
char[] ritorno = new char[stringa.Length * 2];
|
||||
Array.Fill(ritorno, inutile);
|
||||
char[] vocali = { 'a', 'e', 'i', 'o', 'u' };
|
||||
int k = 0;
|
||||
|
||||
|
||||
for (int i = 0; i < stringa.Length; i++) {
|
||||
ritorno[k] = stringa[i];
|
||||
for (int j = 0; j < vocali.Length; j++) {
|
||||
if (stringa[i] == vocali[j]) {
|
||||
k++;
|
||||
ritorno[k] = codice;
|
||||
break;
|
||||
}
|
||||
else if (stringa[i] == char.ToUpper(vocali[j])) {
|
||||
k++;
|
||||
ritorno[k] = char.ToUpper(codice);
|
||||
break;
|
||||
}
|
||||
}
|
||||
k++;
|
||||
|
||||
}
|
||||
|
||||
return string.Join("", ritorno).Split(inutile).First();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user