Advertisement
Guest User

DailyProgrammer, Apr. 9th

a guest
Apr 9th, 2012
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3.  
  4. namespace Application
  5. {
  6.     public class Apr9 // DailyProgrammer, Apr. 9th
  7.     {
  8.         public static int lines;
  9.         public static int words;
  10.         public static string filename;
  11.        
  12.         static public int Main (string[] args)
  13.         {
  14.             filename = args[0];
  15.             lines = File.ReadAllLines(filename).Length;
  16.            
  17.             foreach(string s in File.ReadAllLines (filename))
  18.             {
  19.                 //
  20.                 string[] split = s.Split(" ".ToCharArray());
  21.                
  22.                 words += split.Length;
  23.             }
  24.            
  25.             Console.WriteLine(lines);
  26.             Console.WriteLine(words);
  27.            
  28.             return 0;
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement