word count(小组)
生活随笔
收集整理的這篇文章主要介紹了
word count(小组)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
合作者:201631062314,201631062214
碼云地址:https://gitee.com/dsjyun/Word-Count-three
一、代碼互審:
? ??第一次都是實現了基本功能,沒有完成擴展功能,這次還有個高級功能,于是討論了后續功能如何實現。
我們的意見基本一致,認為高級功能需要窗體來實現比較簡單,于是決定用C#語言來實現。
二、部分代碼
using System; using System.Diagnostics;namespace WordCount {class program{static void Main(string[] args){Console.Write("wc.exe -c file.c\t返回文件 file.c 的字符數\n" +"wc.exe -w file.c\t返回文件 file.c 的單詞總數\n" +"wc.exe -l file.c\t返回文件 file.c 的總行數\n" +"wc.exe -a file.c\t返回更復雜的數據(代碼行/空行/注釋行)\n" +"wc.exe -o output.txt\t將結果輸出到指定文件output.txt\n" +"wc.exe -e stopList.txt\t停用詞表,統計文件單詞總數時,不統計該表中的單詞\n" +"wc.exe -s\t循環執行所有.c文件\n");Wordcount wc = new Wordcount();while (true){Console.WriteLine("--------------------------");Console.WriteLine("輸入命令:");string str = Console.ReadLine();Stopwatch stopwatch = new Stopwatch();stopwatch.Start(); // 開始監視代碼運行時間 wc.ExecutiveCommand(str);stopwatch.Stop(); // 停止監視TimeSpan timespan = stopwatch.Elapsed; // 獲取當前實例測量得出的總時間string hours = timespan.TotalHours.ToString("#0.00000000 "); // 總小時string minutes = timespan.TotalMinutes.ToString("#0.00000000 "); // 總分鐘string seconds = timespan.TotalSeconds.ToString("#0.00000000 "); // 總秒數string milliseconds = timespan.TotalMilliseconds.ToString("#0.00000000 "); // 總毫秒數Console.Write("運行時間 "+timespan);}}} }主函數,性能測試 主函數+性能測試 using System; using System.Diagnostics;namespace WordCount {class program{static void Main(string[] args){Console.Write("wc.exe -c file.c\t返回文件 file.c 的字符數\n" +"wc.exe -w file.c\t返回文件 file.c 的單詞總數\n" +"wc.exe -l file.c\t返回文件 file.c 的總行數\n" +"wc.exe -a file.c\t返回更復雜的數據(代碼行/空行/注釋行)\n" +"wc.exe -o output.txt\t將結果輸出到指定文件output.txt\n" +"wc.exe -e stopList.txt\t停用詞表,統計文件單詞總數時,不統計該表中的單詞\n" +"wc.exe -s\t循環執行所有.c文件\n");Wordcount wc = new Wordcount();while (true){Console.WriteLine("--------------------------");Console.WriteLine("輸入命令:");string str = Console.ReadLine();Stopwatch stopwatch = new Stopwatch();stopwatch.Start(); // 開始監視代碼運行時間 wc.ExecutiveCommand(str);stopwatch.Stop(); // 停止監視TimeSpan timespan = stopwatch.Elapsed; // 獲取當前實例測量得出的總時間string hours = timespan.TotalHours.ToString("#0.00000000 "); // 總小時string minutes = timespan.TotalMinutes.ToString("#0.00000000 "); // 總分鐘string seconds = timespan.TotalSeconds.ToString("#0.00000000 "); // 總秒數string milliseconds = timespan.TotalMilliseconds.ToString("#0.00000000 "); // 總毫秒數Console.Write("運行時間 "+timespan);}}} }主函數,性能測試 功能代碼三、基本功能與擴展功能的測試:
1.數字、單詞、標點符號測試正常
?
?
?
?
?
2.運算符、空行測試,發現空行算作了一個單詞
?
擴展功能,測試正常
四、性能測試
??
通過顯示后臺運行時間發現單一命令的執行逐漸加快 ,三條命令同時執行的時間也遠小于分別執行的時間相加。于是在命令執行的基礎上加上文本的輸出,發現文本寫入用時最多。
?
再經過兩次測試發現程序有后臺存儲功能,記錄了運行的信息,第二次運行時讀取了運行過的結果,所以時間加快了很多。
?
4.總結
(1)代碼合并階段:以前并沒有將兩個人的代碼和在一起,這次發現函數命名沒有一致,需要修改,其實應該先確定函數命名再開始編碼。
(2)體會和感想:高級功能沒有實現,在時間上還是倉促了。這次合作沒有很好的計劃,浪費了很多時間,這次的經驗使得下次有了更多的準備。
轉載于:https://www.cnblogs.com/K-wang/p/9827533.html
總結
以上是生活随笔為你收集整理的word count(小组)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: CryptoZombies学习笔记——L
- 下一篇: node.js 调试 eggs lau