Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- namespace conta_vocali_consonanti_punteggiatura
- {
- class Program
- {
- static void Main(string[] args)
- {
- //Console.WriteLine("Inserisci una frase");
- //string lettura = Console.ReadLine();
- //int vocali = 0, consonanti = 0, punteggiatura = 0, cifre=0;
- //foreach (char c in lettura)
- // switch (char.ToLower(c))
- // {
- // case 'a': case 'e': case 'i': case 'o': case 'u':
- // vocali++;
- // break;
- // case '.': case ',': case ' ': case ';': case '!':
- // punteggiatura++;
- // break;
- // case '0': case '1': case '2': case '3': case '4': case '5':
- // case '6': case '7': case '8': case '9':
- // cifre++;
- // break;
- // default:
- // consonanti++;
- // break;
- // }
- //foreach (char c in lettura)
- //{
- // if ("aeiou".Contains(char.ToLower(c)))
- // vocali++;
- // else
- // if ("!?.,:; /{}\"".Contains(char.ToLower(c)))
- // punteggiatura++;
- // else
- // if ("bcdfghjklmnpqrstvwxyz".Contains(char.ToLower(c)))
- // consonanti++;
- // else
- // if ("0123456789".Contains(char.ToLower(c)))
- // cifre++;
- //}
- //foreach (char c in lettura)
- //{
- // if ("aeiou".Contains(char.ToLower(c)))
- // vocali++;
- // else
- // if (char.IsPunctuation(c))
- // punteggiatura++;
- // else
- // if (char.IsLetter(c))
- // consonanti++;
- // else
- // if (char.IsDigit(c))
- // cifre++;
- //}
- //Console.WriteLine($"Vocali: {vocali}, Consonanti: {consonanti}, " +
- // $"Punteggiatura: {punteggiatura}, Cifre: {cifre}");
- DirectoryInfo cartella = new DirectoryInfo(".");
- long totale_spazio = 0;
- foreach (FileInfo file in cartella.GetFiles())
- {
- Console.WriteLine($"File: {file.Name.PadRight(60, ' ')} - Dimensione: {file.Length}bytes");
- totale_spazio += file.Length;
- }
- Console.WriteLine($"\n----------Totale spazio occupato dalla cartella: {totale_spazio}bytes");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement