From 044d88a2effb29457d2f540e728761aa6af26410 Mon Sep 17 00:00:00 2001
From: 1320068008 <48875230+1320068008@users.noreply.github.com>
Date: Fri, 5 Apr 2019 16:21:44 +0800
Subject: [PATCH 1/2] Create 201731062431
---
201731062431 | 1 +
1 file changed, 1 insertion(+)
create mode 100644 201731062431
diff --git a/201731062431 b/201731062431
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/201731062431
@@ -0,0 +1 @@
+
From 047abfac8ce70a97d10bea9976f2f7bd1087aa7d Mon Sep 17 00:00:00 2001
From: 1320068008 <1320068008@qq.com>
Date: Fri, 5 Apr 2019 16:55:27 +0800
Subject: [PATCH 2/2] first Commit
---
1320068008/Wordcount-master/.gitattributes | 63 +++++
1320068008/Wordcount-master/.gitignore | 261 ++++++++++++++++++
.../UnitTestWCT/Properties/AssemblyInfo.cs | 20 ++
.../Wordcount/UnitTestWCT/UnitTest1.cs | 36 +++
.../Wordcount/UnitTestWCT/UnitTestWCT.csproj | 74 +++++
.../Wordcount/UnitTestWCT/packages.config | 5 +
.../1320068008/Wordcount/Wordcount.sln | 31 +++
.../1320068008/Wordcount/Wordcount/App.config | 6 +
.../Wordcount/Wordcount/MajorFun.cs | 171 ++++++++++++
.../1320068008/Wordcount/Wordcount/Program.cs | 126 +++++++++
.../Wordcount/Properties/AssemblyInfo.cs | 36 +++
.../Wordcount/Wordcount/Wordcount.csproj | 54 ++++
.../test1.txt" | 5 +
.../test2.txt" | 27 ++
.../unittest.txt" | 2 +
.../unittest1.txt" | 1 +
1320068008/Wordcount-master/201731062431 | 1 +
1320068008/Wordcount-master/README.md | 2 +
18 files changed, 921 insertions(+)
create mode 100644 1320068008/Wordcount-master/.gitattributes
create mode 100644 1320068008/Wordcount-master/.gitignore
create mode 100644 1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/Properties/AssemblyInfo.cs
create mode 100644 1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/UnitTest1.cs
create mode 100644 1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/UnitTestWCT.csproj
create mode 100644 1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/packages.config
create mode 100644 1320068008/Wordcount-master/1320068008/Wordcount/Wordcount.sln
create mode 100644 1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/App.config
create mode 100644 1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/MajorFun.cs
create mode 100644 1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/Program.cs
create mode 100644 1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/Properties/AssemblyInfo.cs
create mode 100644 1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/Wordcount.csproj
create mode 100644 "1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/test1.txt"
create mode 100644 "1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/test2.txt"
create mode 100644 "1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/unittest.txt"
create mode 100644 "1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/unittest1.txt"
create mode 100644 1320068008/Wordcount-master/201731062431
create mode 100644 1320068008/Wordcount-master/README.md
diff --git a/1320068008/Wordcount-master/.gitattributes b/1320068008/Wordcount-master/.gitattributes
new file mode 100644
index 0000000..1ff0c42
--- /dev/null
+++ b/1320068008/Wordcount-master/.gitattributes
@@ -0,0 +1,63 @@
+###############################################################################
+# Set default behavior to automatically normalize line endings.
+###############################################################################
+* text=auto
+
+###############################################################################
+# Set default behavior for command prompt diff.
+#
+# This is need for earlier builds of msysgit that does not have it on by
+# default for csharp files.
+# Note: This is only used by command line
+###############################################################################
+#*.cs diff=csharp
+
+###############################################################################
+# Set the merge driver for project and solution files
+#
+# Merging from the command prompt will add diff markers to the files if there
+# are conflicts (Merging from VS is not affected by the settings below, in VS
+# the diff markers are never inserted). Diff markers may cause the following
+# file extensions to fail to load in VS. An alternative would be to treat
+# these files as binary and thus will always conflict and require user
+# intervention with every merge. To do so, just uncomment the entries below
+###############################################################################
+#*.sln merge=binary
+#*.csproj merge=binary
+#*.vbproj merge=binary
+#*.vcxproj merge=binary
+#*.vcproj merge=binary
+#*.dbproj merge=binary
+#*.fsproj merge=binary
+#*.lsproj merge=binary
+#*.wixproj merge=binary
+#*.modelproj merge=binary
+#*.sqlproj merge=binary
+#*.wwaproj merge=binary
+
+###############################################################################
+# behavior for image files
+#
+# image files are treated as binary by default.
+###############################################################################
+#*.jpg binary
+#*.png binary
+#*.gif binary
+
+###############################################################################
+# diff behavior for common document formats
+#
+# Convert binary document formats to text before diffing them. This feature
+# is only available from the command line. Turn it on by uncommenting the
+# entries below.
+###############################################################################
+#*.doc diff=astextplain
+#*.DOC diff=astextplain
+#*.docx diff=astextplain
+#*.DOCX diff=astextplain
+#*.dot diff=astextplain
+#*.DOT diff=astextplain
+#*.pdf diff=astextplain
+#*.PDF diff=astextplain
+#*.rtf diff=astextplain
+#*.RTF diff=astextplain
diff --git a/1320068008/Wordcount-master/.gitignore b/1320068008/Wordcount-master/.gitignore
new file mode 100644
index 0000000..3c4efe2
--- /dev/null
+++ b/1320068008/Wordcount-master/.gitignore
@@ -0,0 +1,261 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+
+# User-specific files
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+bld/
+[Bb]in/
+[Oo]bj/
+[Ll]og/
+
+# Visual Studio 2015 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUNIT
+*.VisualState.xml
+TestResult.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# DNX
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+*_i.c
+*_p.c
+*_i.h
+*.ilk
+*.meta
+*.obj
+*.pch
+*.pdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# JustCode is a .NET coding add-in
+.JustCode
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# TODO: Comment the next line if you want to checkin your web deploy settings
+# but database connection strings (with potential passwords) will be unencrypted
+#*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# The packages folder can be ignored because of Package Restore
+**/packages/*
+# except build/, which is used as an MSBuild target.
+!**/packages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/packages/repositories.config
+# NuGet v3's project.json files produces more ignoreable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+node_modules/
+orleans.codegen.cs
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+
+# SQL Server files
+*.mdf
+*.ldf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# JetBrains Rider
+.idea/
+*.sln.iml
+
+# CodeRush
+.cr/
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
\ No newline at end of file
diff --git a/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/Properties/AssemblyInfo.cs b/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..83a8fab
--- /dev/null
+++ b/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/Properties/AssemblyInfo.cs
@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("UnitTestWCT")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("UnitTestWCT")]
+[assembly: AssemblyCopyright("Copyright © 2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("a375bf7a-e8c1-4d5d-ae87-97db9ef07796")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/UnitTest1.cs b/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/UnitTest1.cs
new file mode 100644
index 0000000..ead78b1
--- /dev/null
+++ b/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/UnitTest1.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Linq;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using Wordcount;
+namespace UnitTestWCT
+{
+ [TestClass]
+ public class UnitTest1
+ {
+ [TestMethod]
+ public void TestMethod1()
+ {
+ byte[] res = Enumerable.Repeat((byte)0x08, 10).ToArray();
+ MajorFun majorFun = new MajorFun();
+ Assert.AreEqual(res.Length,(int)(majorFun.CountChar(res)));
+ }
+ [TestMethod]
+ public void TestMethod2()
+ {
+ MajorFun majorFun = new MajorFun();
+ string path = @"D:\第二次vs存储位置作业\Wordcount\1320068008\新建文件夹\unittest.txt";
+ string path1 = @"D:\第二次vs存储位置作业\Wordcount\1320068008\新建文件夹\unittest1.txt";
+ Assert.AreEqual(1,majorFun.CountE_word(path,1,3));
+ majorFun.WritoFile(path1);
+ }
+ [TestMethod]
+ public void TestMethod3()
+ {
+ MajorFun majorFun = new MajorFun();
+ string path = @"D:\第二次vs存储位置作业\Wordcount\1320068008\新建文件夹\unittest.txt";
+ string path1 = @"D:\第二次vs存储位置作业\Wordcount\1320068008\新建文件夹\unittest1.txt";
+ majorFun.GetRows(path);
+ majorFun.WritoFile(path1);
+ }
+ }
+}
diff --git a/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/UnitTestWCT.csproj b/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/UnitTestWCT.csproj
new file mode 100644
index 0000000..a92afb9
--- /dev/null
+++ b/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/UnitTestWCT.csproj
@@ -0,0 +1,74 @@
+
+
+
+
+
+ Debug
+ AnyCPU
+ {A375BF7A-E8C1-4D5D-AE87-97DB9EF07796}
+ Library
+ Properties
+ UnitTestWCT
+ UnitTestWCT
+ v4.6.1
+ 512
+ {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
+ 15.0
+ $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
+ $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages
+ False
+ UnitTest
+
+
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll
+
+
+ ..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {43c83c05-ab84-4cfe-83b1-ba69913b2d2c}
+ Wordcount
+
+
+
+
+
+
+ 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。
+
+
+
+
+
+
\ No newline at end of file
diff --git a/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/packages.config b/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/packages.config
new file mode 100644
index 0000000..102a45c
--- /dev/null
+++ b/1320068008/Wordcount-master/1320068008/Wordcount/UnitTestWCT/packages.config
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount.sln b/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount.sln
new file mode 100644
index 0000000..71e088f
--- /dev/null
+++ b/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28010.2016
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wordcount", "Wordcount\Wordcount.csproj", "{43C83C05-AB84-4CFE-83B1-BA69913B2D2C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTestWCT", "UnitTestWCT\UnitTestWCT.csproj", "{A375BF7A-E8C1-4D5D-AE87-97DB9EF07796}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {43C83C05-AB84-4CFE-83B1-BA69913B2D2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {43C83C05-AB84-4CFE-83B1-BA69913B2D2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {43C83C05-AB84-4CFE-83B1-BA69913B2D2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {43C83C05-AB84-4CFE-83B1-BA69913B2D2C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A375BF7A-E8C1-4D5D-AE87-97DB9EF07796}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A375BF7A-E8C1-4D5D-AE87-97DB9EF07796}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A375BF7A-E8C1-4D5D-AE87-97DB9EF07796}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A375BF7A-E8C1-4D5D-AE87-97DB9EF07796}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {791FD4A0-4707-421C-8327-E36645B00EB6}
+ EndGlobalSection
+EndGlobal
diff --git a/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/App.config b/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/App.config
new file mode 100644
index 0000000..731f6de
--- /dev/null
+++ b/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/MajorFun.cs b/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/MajorFun.cs
new file mode 100644
index 0000000..d6cb4a7
--- /dev/null
+++ b/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/MajorFun.cs
@@ -0,0 +1,171 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Collections;
+using System.Text.RegularExpressions;
+using System.IO;
+
+namespace Wordcount
+{
+ public class MajorFun
+ {
+ ArrayList list = new ArrayList();
+ List Cout = new List();
+ long Count1 = 0;
+ //此函数用于计算文本Ascii码字符个数
+ public long CountChar(byte [] data)
+ {
+ long Count=0;
+ for(long i=0;i= 0 && data[i] <= 127)
+ {
+ Count++;
+ }
+ if(data[i]=='\n')
+ {
+ Count1++;
+ }
+ }
+ long c = Count - Count1;
+ Cout.Add("字符个数:"+c);
+ Console.WriteLine("字符个数:"+(Count-Count1));
+ return Count;
+ }
+ //此函数用于计算统计出现次数在前十的单词
+ public int CountE_word(string path, int m,int n)
+ {
+ List list = new List();
+ List list1 = new List();
+ Dictionary frequencies = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ Dictionary frequencies1 = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ string s = "";
+ string s1 = "";
+ if (File.Exists(path))
+ {
+ StreamReader sr = new StreamReader(path, Encoding.Default);
+ string line;
+ while ((line = sr.ReadLine()) != null)
+ {
+ string[] wordsArr1 = Regex.Split(line.ToLower(), "\\s*[^0-9a-zA-Z]+");
+ foreach (string word in wordsArr1)
+ {
+ if (Regex.IsMatch(word, "^[a-zA-Z]{4,}[a-zA-Z0-9]*"))
+ {
+ list.Add(word);
+ list1.Add(word);
+ }
+ }
+
+ }
+ sr.Close();
+
+ for (int i = 0; i <= list.Count - 1; i++)
+ {
+ int j;
+ for (s = list[i], j = 0; j < 0; j++)
+ {
+ s += " " + list[i + j + 1];
+ }
+ if (frequencies.ContainsKey(s))
+ {
+ frequencies[s]++;
+ }
+ else
+ frequencies[s] = 1;
+ }
+ int o = 0;
+ Console.WriteLine("单词频率前" + n + "名及其出现的次数:");
+ Dictionary item = frequencies.OrderByDescending(r => r.Value).ThenBy(r => r.Key).ToDictionary(r => r.Key, r => r.Value);
+ foreach (KeyValuePair entry in item)
+ {
+ o++;
+ if (o > n)
+ break;
+ string word = entry.Key;
+ int frequency = entry.Value;
+ Console.WriteLine("No." + o + " " + word + " : " + frequency + "次 ");
+ Cout.Add("No." + o + " " + word + " : " + frequency + "次 ");
+ }
+ for (int i = 0; i <= list1.Count - m; i++)
+ {
+ int j;
+ for (s1 = list1[i], j = 0; j < m - 1; j++)
+ {
+ s1 += " " + list1[i + j + 1];
+ }
+ if (frequencies1.ContainsKey(s1))
+ {
+ frequencies1[s1]++;
+ }
+ else
+ frequencies1[s1] = 1;
+ }
+ Dictionary item1 = frequencies1.OrderByDescending(r => r.Value).ThenBy(r => r.Key).ToDictionary(r => r.Key, r => r.Value);
+ Console.WriteLine("输出长度为" + m + "的单词组:");
+ Cout.Add("输出长度为" + m + "的单词组:");
+ foreach (var dic1 in item1)
+ {
+ Console.Write(" {0} {1}次\n", dic1.Key, dic1.Value);
+ Cout.Add(dic1.Key.ToString() + " " + dic1.Value + "次");
+ }
+ Console.WriteLine("单词总数:");
+ Console.WriteLine("{0}个", list.Count);
+ Cout.Add("单词总数:" + list.Count);
+ return 1;
+ }
+ else
+ {
+ return -1;
+ }
+ }
+ //此函数用于计算文本有效行数
+ public void GetRows(string path)
+ {
+ try
+ {
+ using (StreamReader sr = new StreamReader(path))
+ {
+ String line;
+ int Countline=0;
+ for(int i=0;i<=Count1;i++)
+ {
+ if((line = sr.ReadLine()).Trim()!=string.Empty)
+ {
+ Countline++;
+ }
+ }
+ Console.WriteLine("行数 :"+Countline);
+ Cout.Add("行数 :"+Countline);
+
+ }
+ }
+ catch (Exception ex)
+ {
+ Console.WriteLine(ex.ToString());
+ }
+ }
+ //此函数用于将屏幕上输出内容写入指定文件
+ public void WritoFile(string path)
+ {
+ if (!File.Exists(path))
+ {
+ Console.WriteLine("路径不存在!");
+ }
+ else
+ {
+ FileStream fs = new FileStream(path,FileMode.Create, FileAccess.Write);
+ StreamWriter sr = new StreamWriter(fs);
+ foreach(string w in Cout)
+ {
+ sr.WriteLine(w);
+ }
+ Console.WriteLine("写入成功");
+ sr.Close();
+ fs.Close();
+ }
+ }
+ }
+}
diff --git a/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/Program.cs b/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/Program.cs
new file mode 100644
index 0000000..539a41b
--- /dev/null
+++ b/1320068008/Wordcount-master/1320068008/Wordcount/Wordcount/Program.cs
@@ -0,0 +1,126 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.IO;
+
+namespace Wordcount
+{
+ class FileOp
+ {
+ public string path;
+ public byte[] zipdata;
+ public void GetPath()
+ {
+ Console.WriteLine("请输入文件路径:");
+ path = Console.ReadLine();
+ }
+ //此函数用于读取文本文件内容
+ public byte[] ReadFile(string path)
+ {
+ if (File.Exists(path))
+ {
+ FileStream fs = new FileStream(path, FileMode.Open);
+ zipdata = new byte[fs.Length];
+ fs.Read(zipdata, 0, zipdata.Length);
+ fs.Close();
+ return zipdata;
+ }
+ else
+ {
+ Console.WriteLine("路径不存在!");
+ return zipdata;
+ }
+ }
+ //此函数用于调用主功能函数
+ public void Movedata(int m,int n,string p)
+ {
+ MajorFun Maj = new MajorFun();
+ Maj.CountChar(zipdata);
+ Maj.CountE_word(path,m,n);
+ Maj.GetRows(path);
+ Maj.WritoFile(p);
+ }
+ }
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ FileOp f = new FileOp();
+ int m=1, n=10;
+ int i = 0;
+ string[] arg;
+ arg = Sort(args);
+ if (arg.Length != 0)
+ {
+ for (i = 0; i < arg.Length; i++)
+ {
+ if (arg[i] == "-m")
+ {
+ m = int.Parse(arg[i + 1]);
+ }
+ if (arg[i] == "-n")
+ {
+ n = int.Parse(arg[i + 1]);
+ }
+ }
+ f.path = arg[1];
+ f.ReadFile(f.path);
+ f.Movedata(m, n, arg[arg.Length - 1]);
+ Console.ReadKey();
+ }
+ else
+ {
+ Console.WriteLine("缺少有效读入或输出文件路径或命令指示标志");
+ }
+
+ }
+ static string [] Sort(string[] w)
+ {
+ int i=0;
+ int count=0;
+ while(i
+
+
+
+ Debug
+ AnyCPU
+ {43C83C05-AB84-4CFE-83B1-BA69913B2D2C}
+ Exe
+ Wordcount
+ Wordcount
+ v4.6.1
+ 512
+ true
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git "a/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/test1.txt" "b/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/test1.txt"
new file mode 100644
index 0000000..36f4e89
--- /dev/null
+++ "b/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/test1.txt"
@@ -0,0 +1,5 @@
+if she's amazing, she won't be easy.
+if she's easy, she won't be amazing.
+
+amazing,wonderfulmaybe ,what a beatiful life,watt,cars ,arrplane,airplane
+uuus.
\ No newline at end of file
diff --git "a/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/test2.txt" "b/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/test2.txt"
new file mode 100644
index 0000000..8c82a55
--- /dev/null
+++ "b/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/test2.txt"
@@ -0,0 +1,27 @@
+字符个数:154
+No.1 amazing : 3次
+No.2 easy : 2次
+No.3 airplane : 1次
+No.4 arrplane : 1次
+No.5 beatiful : 1次
+No.6 cars : 1次
+No.7 life : 1次
+No.8 maybe : 1次
+No.9 uuus : 1次
+No.10 watt : 1次
+输出长度为3的单词组:
+amazing amazing wonderful 1次
+amazing easy easy 1次
+amazing wonderful maybe 1次
+arrplane airplane uuus 1次
+beatiful life watt 1次
+cars arrplane airplane 1次
+easy amazing amazing 1次
+easy easy amazing 1次
+life watt cars 1次
+maybe what beatiful 1次
+watt cars arrplane 1次
+what beatiful life 1次
+wonderful maybe what 1次
+单词总数:15
+行数 :4
diff --git "a/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/unittest.txt" "b/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/unittest.txt"
new file mode 100644
index 0000000..8175e4e
--- /dev/null
+++ "b/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/unittest.txt"
@@ -0,0 +1,2 @@
+qwer ddree dfsse sseer
+qwer ddas dfsse
\ No newline at end of file
diff --git "a/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/unittest1.txt" "b/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/unittest1.txt"
new file mode 100644
index 0000000..841d177
--- /dev/null
+++ "b/1320068008/Wordcount-master/1320068008/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/unittest1.txt"
@@ -0,0 +1 @@
+行数 :2
diff --git a/1320068008/Wordcount-master/201731062431 b/1320068008/Wordcount-master/201731062431
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/1320068008/Wordcount-master/201731062431
@@ -0,0 +1 @@
+
diff --git a/1320068008/Wordcount-master/README.md b/1320068008/Wordcount-master/README.md
new file mode 100644
index 0000000..1784664
--- /dev/null
+++ b/1320068008/Wordcount-master/README.md
@@ -0,0 +1,2 @@
+# Wordcount
+homework no.3