标签:amr 知识 技术 进度条 content 哈希 下载 控制 没有
一.完成一个小程序
我 拿到这个题目之后,就决定用最不熟悉的c#来实现,因为老师说不懂的去学才会有进步。布置任务后的第二天就开始去图书馆借了两本书《c#从入门到精髓》,《c#项目实战》,拿到书之后看了入门书《c#从入门到精髓》,看书的过程时痛苦的,因为发现大二选修课学的c#全交还给老师了,只能重头再学了。唯一有点印象的就是窗口应用程序,基于UI的设计。
写代码首先需要工具,由于电脑上没有visual studio的安装包,当时求助了度娘。
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace wf
{
class Program
{
static void Main(string[] args)
{
string theFileName;
Console.Write(">type ");
theFileName=Console.ReadLine();
string thePath = @"D:\vs2010\test.txt";
//string thePath = null;
//Console.Write(">type ");
//thePath = Console.ReadLine();
//StreamReader content = File.OpenText(thePath);
//读取文件内容并输出
StreamReader reader = new StreamReader(thePath);
string sline=reader.ReadLine();
Console.WriteLine(sline.ToString());
sline = sline.ToLower();//全部变为小写字母
//定义一个字符数组
char[] c = { ‘ ‘, ‘,‘, ‘.‘, ‘?‘, ‘!‘, ‘:‘, ‘;‘, ‘\‘‘, ‘\"‘ };
//分隔字符串后产生的字符串数组
string[] S = sline.Split(c);
//Console.WriteLine();
//Console.WriteLine(">wf -s test.txt");
// Console.WriteLine("total " + S.Length);
//建立哈希表
Hashtable ha = new Hashtable();
for (int i = 0; i < S.Length; i++)
{
//判断文本是否进入
if (ha.ContainsKey(S[i]))
{
ha[S[i]] = (int)ha[S[i]] + 1;
}
else
{
ha.Add(S[i], 1);
}
}
//int sum = 0;
string[] arrKey = new string[ha.Count];//存哈希表的键
int[] arrValue = new int[ha.Count];//存哈希表的值
ha.Keys.CopyTo(arrKey, 0);
ha.Values.CopyTo(arrValue, 0);
Console.WriteLine();
Console.WriteLine(">wf -s test.txt");
Console.WriteLine("total " + ha.Count);
Console.WriteLine();
Array.Sort(arrValue,arrKey);//按哈希表的值进行排序
//遍历哈希表
//foreach (DictionaryEntry de in ha)
//{
//输出
// Console.WriteLine(de.Key + ":" + de.Value);
//Console.Write(ha.Count);
// }
for (int i = arrKey.Length - 1; i >= 0; i--)
{
if ((string)arrKey[i] != "")
{
Console.Write(arrKey[i].ToString() + ":");
Console.WriteLine(arrValue[i].ToString());
}
}
}
}
}
实现的截图如下:

二.例行报告
1.PSP(personal software process)个人软件过程
| 类别 | 任务 | 开始时间 | 结束时间 | 打扰时间 | 净时间 |
| 借书 | 借书 | 2017.9.15 10:00 | 2017.9.15 10:20 | 无 | 20min |
| 看书 | 2017 9.15 12:20 | 2017.9.16 21:15 | n多打扰时间 |
<5h |
|
| 编程 | 写代码 | 2017 9.16 18:00 | 2017.9.16 21:30 | 洗漱30min,回复消息20min | 2h40min |
| 写作 | 写博客 | 2017.9.16 21:50 | 2017.9.16 22:30 | 无 | 40min |
2.进度条
| 代码行 | 博文字数 | 知识点 | |
| 第二周 | 83 | 800 | 见博客词频统计-功能一 |
标签:amr 知识 技术 进度条 content 哈希 下载 控制 没有
原文地址:http://www.cnblogs.com/huyourongmonkey/p/7533249.html