using System; using System.IO; public class WordCountEntry { static void Main(string[] args) { if (args.Length==0) { display_usage(); return ; } else /* bool traceOn=false; bool spyOn=false; foreach ( string option in args ) { if (option.Equals("-t")) traceOn=true; else if(option.Equals("-s")) spyOn=true; else if(option.Equals("-h")) {display_usage(); return; } else Cosole.WriteLine("check_valid_file_type(option)"); }/ Console.WriteLine( "Beginning WordCount program ... " ); WordCount theObj = new WordCount(); theObj.processFile(); Console.WriteLine( "Ending WordCount program ... " ); } public static void display_usage() { string usage= @"usage:WordCount[-s] [-t] [-h] textfile.txt where[] indicates an optional argument -s prints a series of performance measurements -t prints a trace of the program -h prints this message"; Console.WriteLine(usage); } } public class WordCount { public void processFile() { openFiles(); readFile(); countWords(); writeWords(); } private void countWords() { Console.WriteLine( "!!! WordCount.countWords()" ); } private void readFile() { / string text_line; while ((text_line=freader.ReadLine() )!=null) { //write to output file fwriter.WriteLine(text_line ); } //must explicitly close the readers freader.Close(); fwrriter.Close();/ Console.WriteLine( "!!! WordCount.readFile()" ); } private void openFiles() { string file_name=@"a.txt"; StreamReader freader=File.OpenText(file_name); StreamWriter fwriter=File.CreateText(@"a.diag"); Console.WriteLine( "!!! WordCount.openFiles()" ); } / public static void display_usage() { string usage= @"usage:WordCount[-s] [-t] [-h] textfile.txt where[] indicates an optional argument -s prints a series of performance measurements -t prints a trace of the program -h prints this message"; Console.WriteLine(usage); }*/ private void writeWords() { Console.WriteLine( "!!! WordCount.writeWords()" ); } }
wordcount's Introduction
wordcount's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.