Advertisement
fcamuso

Untitled

Jun 1st, 2020
564
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.28 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3.  
  4. namespace conta_vocali_consonanti_punteggiatura
  5. {
  6.   class Program
  7.   {
  8.     static void Main(string[] args)
  9.     {
  10.       //Console.WriteLine("Inserisci una frase");
  11.       //string lettura = Console.ReadLine();
  12.      
  13.       //int vocali = 0, consonanti = 0, punteggiatura = 0, cifre=0;
  14.  
  15.       //foreach (char c in lettura)
  16.       //  switch (char.ToLower(c))
  17.       //  {
  18.       //    case 'a': case 'e': case 'i': case 'o': case 'u':
  19.       //      vocali++;
  20.       //    break;
  21.  
  22.       //    case '.': case ',': case ' ': case ';': case '!':
  23.       //      punteggiatura++;
  24.       //    break;
  25.  
  26.       //    case '0': case '1': case '2': case '3': case '4': case '5':
  27.       //    case '6': case '7': case '8': case '9':
  28.       //      cifre++;
  29.       //      break;
  30.  
  31.       //    default:
  32.       //      consonanti++;
  33.       //    break;
  34.       //  }
  35.  
  36.       //foreach (char c in lettura)
  37.       //{
  38.       //  if ("aeiou".Contains(char.ToLower(c)))
  39.       //    vocali++;
  40.       //  else
  41.       //    if ("!?.,:; /{}\"".Contains(char.ToLower(c)))
  42.       //      punteggiatura++;
  43.       //    else
  44.       //      if ("bcdfghjklmnpqrstvwxyz".Contains(char.ToLower(c)))
  45.       //        consonanti++;
  46.       //      else
  47.       //        if ("0123456789".Contains(char.ToLower(c)))
  48.       //          cifre++;
  49.       //}
  50.  
  51.       //foreach (char c in lettura)
  52.       //{
  53.       //  if ("aeiou".Contains(char.ToLower(c)))
  54.       //    vocali++;
  55.       //  else
  56.       //    if (char.IsPunctuation(c))
  57.       //    punteggiatura++;
  58.       //  else
  59.       //    if (char.IsLetter(c))
  60.       //      consonanti++;
  61.       //    else
  62.       //       if (char.IsDigit(c))
  63.       //        cifre++;
  64.       //}
  65.       //Console.WriteLine($"Vocali: {vocali}, Consonanti: {consonanti}, " +
  66.       //                  $"Punteggiatura: {punteggiatura}, Cifre: {cifre}");
  67.  
  68.  
  69.       DirectoryInfo cartella = new DirectoryInfo(".");
  70.       long totale_spazio = 0;
  71.  
  72.       foreach (FileInfo file in cartella.GetFiles())
  73.       {
  74.         Console.WriteLine($"File: {file.Name.PadRight(60, ' ')} - Dimensione: {file.Length}bytes");
  75.         totale_spazio += file.Length;
  76.       }
  77.  
  78.       Console.WriteLine($"\n----------Totale spazio occupato dalla cartella:  {totale_spazio}bytes");
  79.  
  80.  
  81.     }
  82.   }
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement