Guest User

Untitled

a guest
May 26th, 2018
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3.  
  4. class CodeOfEthics
  5.  
  6. {
  7. static void Main( )
  8. {
  9. StreamReader inStream = null;
  10. string filename = "codeofethics.txt";
  11. int counter = 0;
  12. string line;
  13.  
  14. inStream = new StreamReader( filename );
  15.  
  16. do
  17. {
  18. line = inStream.ReadLine( );
  19. line.ToLower();
  20. foreach(char c in line)
  21. {
  22. if(c == 'a')
  23. {
  24. counter++;
  25. }
  26. }
  27.  
  28. }while(counter != -1);
  29. Console.WriteLine(counter);
  30. inStream.Close();
  31.  
  32. }
  33. }
Add Comment
Please, Sign In to add comment