public int ins_select(string[] array, int i, word_len len, word_more more) { int flag = 0; if (array[i].Equals(str1, StringComparison.OrdinalIgnoreCase) == true) { file_path.input_path = array[i + 1]; flag = 1; } else if (array[i].Equals(str2, StringComparison.OrdinalIgnoreCase) == true) { len.Wordlen = Convert.ToInt32(array[i + 1]); //result.WL.Wordlen = Convert.ToInt32(array[i+1]); flag = 2; } else if (array[i].Equals(str3, StringComparison.OrdinalIgnoreCase) == true) { //result.WM.Wordmore = Convert.ToInt32(array[i + 1]); more.Wordmore = Convert.ToInt32(array[i + 1]); flag = 4; } else if (array[i].Equals(str4, StringComparison.OrdinalIgnoreCase) == true) { file_path.output_path = array[i + 1]; flag = 8; } else { flag = -16; } return(flag); }
public void instruction(word_len len, word_more more) { ill2.illu_function(); Console.WriteLine("input your instructions"); string all_char = Console.ReadLine(); string[] ins_arr = all_char.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); int ind_sum = 0; for (int i = 0; i < ins_arr.Length; i = i + 2) { ind_sum = ind_sum + inp1.ins_select(ins_arr, i, len, more); } inp1.ins_right(ind_sum, len, more); }
public void nointrction(word_len len, word_more more) { Console.WriteLine("the input path:"); string inputpath = Console.ReadLine(); file_path.input_path = inputpath; //result.Word_more = 10; //result.Word_len = 0; Console.WriteLine("the output path:"); string outputpath = Console.ReadLine(); file_path.output_path = outputpath; //re1.WM.Wordmore = 10; re1.print_char(); re1.print_word(len); re1.print_lines(); re1.print_wordsort(more.Wordmore, len); }
//文件路径 file_path //单词总数 word_sum //单词频数 word_frequency static void Main(string[] args) { word_len WL1 = new word_len(0); word_more WM1 = new word_more(10); illustration ill1 = new illustration(); select_way sw1 = new select_way(); ill1.illu_way(); int cmd_num = Convert.ToInt32(Console.ReadLine()); switch (cmd_num) { case 1: sw1.instruction(WL1, WM1); break; case 2: sw1.nointrction(WL1, WM1); break; default: sw1.the_error(); break; } Console.ReadKey(); }
public void ins_right(int x, word_len len, word_more more) { if (x > 0) { if (x % 2 == 0) { Console.WriteLine("need a input file"); Console.ReadKey(); } else { if (x == 1) { //result.Word_more = 10; file_path.output_path = "output.txt"; //result.Word_len = 0; re2.print_char(); re2.print_word(len); re2.print_lines(); re2.print_wordsort(more.Wordmore, len); } else if (x == 3) { //result.Word_more = 10; file_path.output_path = "output.txt"; re2.print_char(); re2.print_word(len); re2.print_lines(); re2.print_wordsort(more.Wordmore, len); re2.print_selectedlong(len.Wordlen); } else if (x == 5) { file_path.output_path = "output.txt"; //result.Word_len = 0; re2.print_char(); re2.print_word(len); re2.print_lines(); re2.print_wordsort(more.Wordmore, len); } else if (x == 7) { file_path.output_path = "output.txt"; re2.print_char(); re2.print_word(len); re2.print_lines(); re2.print_wordsort(more.Wordmore, len); re2.print_selectedlong(len.Wordlen); } else if (x == 9) { //result.Word_more = 10; //result.Word_len = 0; re2.print_char(); re2.print_word(len); re2.print_lines(); re2.print_wordsort(more.Wordmore, len); } else if (x == 11) { //result.Word_more = 10; re2.print_char(); re2.print_word(len); re2.print_lines(); re2.print_wordsort(more.Wordmore, len); re2.print_selectedlong(len.Wordlen); } else if (x == 13) { //result.Word_len = 0; re2.print_char(); re2.print_word(len); re2.print_lines(); re2.print_wordsort(more.Wordmore, len); } else { re2.print_char(); re2.print_word(len); re2.print_lines(); re2.print_wordsort(more.Wordmore, len); re2.print_selectedlong(len.Wordlen); } } } else { Console.WriteLine("the wrong instruction"); Console.ReadKey(); } }