Advertisement
Guest User

Untitled

a guest
Nov 25th, 2014
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Linq;
  4.  
  5. class Program
  6. {
  7. public static void Main()
  8. {
  9. string FilePath = Console.ReadLine();
  10.  
  11. while (File.Exists(FilePath) == false)
  12. {
  13. Console.WriteLine("File not found, enter a vaild file path.");
  14. FilePath = Console.ReadLine();
  15. }
  16. string FileContent = File.ReadAllText(FilePath);
  17.  
  18. Console.WriteLine("Grades are: {0}", FileContent);
  19.  
  20. int resultA = FileContent.Count(c => c == 'A');
  21. int resultB = FileContent.Count(c => c == 'B');
  22. int resultC = FileContent.Count(c => c == 'C');
  23. int resultD = FileContent.Count(c => c == 'D');
  24. int resultE = FileContent.Count(c => c == 'E');
  25. int resultF = FileContent.Count(c => c == 'F');
  26.  
  27.  
  28. Console.WriteLine("{0}", resultA);
  29.  
  30.  
  31. Console.ReadLine();
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement