using System; using System.IO; namespace PS8_Q1 { // // Problem Set 8, Question 1 // Written by Paul Hudak // November 15, 2006 // class Class1 { // // Program Design Exercise 18 in Chapter 11 // [STAThread] static void Main(string[] args) { // declare streams outside of "try" so that they can be // referenced in the "finally" clause StreamReader f_in = null; StreamWriter f_out = null; try { // open the input and output files f_in = new StreamReader(args[0]); f_out = new StreamWriter(args[1]); // create one array and reuse it inside loop string[] sa; // read lines from input file, remove extra spaces, // and write result to output file string s = f_in.ReadLine(); while (s!=null) // if s==null we're done { sa = s.Split(); // split line into array of words for (int i=0; i