资源简介
成语接龙C#代码以前写的,暂时放这里,需要优化。

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace Idiom
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private Idioms Idioms;
private int maxLength = 0;
private int oldLength = 0;
// private List> Dragons = new List>();
List maxDragon = new List();
private void Form1_Load(object sender EventArgs e)
{
Idioms = new Idioms();
// ReadFile();
}
private void button1_Click(object sender EventArgs e)
{
this.timer1.Start();
string str = this.textBox1.Text;
char lastChar = str.Substring(str.Length - 1).ToCharArray()[0];
short Head = (short)((int)lastChar - short.MaxValue);
maxLength = 0;
oldLength = 0;
this.richTextBox1.Text = ““;
if (Idioms.IdiomHeads.ContainsKey(Head))
{
//第一个龙
List idiomList = Idioms.IdiomHeads[Head];
foreach (theIdiom idiom in idiomList)
{
List Dragon = new List();
Dragon.Add(idiom.Id);
makeDragons(Dragon);
}
}
else
{
MessageBox.Show(“不存在可接成语!“);
return;
}
this.timer1.Stop();
}
private void makeDragons(List Dragon)
{
short last = Dragon[Dragon.Count - 1];
theIdiom theIdiom = Idioms.TotalIdioms[last];
short Head = theIdiom.T;
if (Idioms.IdiomHeads.ContainsKey(Head))
{
List idiomList = Idioms.IdiomHeads[Head];
foreach (theIdiom idiom in idiomList)
{
short newid = idiom.Id;
//如果无环就添加;
if (!Dragon.Contains(newid))
{
List newdragon = new List(Dragon);
newdragon.Add(idiom.Id);
if (newdragon.Count > maxLength)
{
maxLength = newdragon.Count;
maxDragon = newdragon;
this.label1.Text = maxLength.ToString();
this.label1.Refresh();
}
//递归
Application.DoEvents();
makeDragons(newdragon);
}
}
}
}
private string showDr
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1603121 2007-11-02 01:23 Idiom\Idiom\bin\Debug\1.txt
文件 5057 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\001.txt
文件 2051 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\002.txt
文件 4427 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\003.txt
文件 86247 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\004.txt
文件 35008 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\005.txt
文件 202909 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\006.txt
文件 173091 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\007.txt
文件 66866 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\008.txt
文件 5111 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\009.txt
文件 49268 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\010.txt
文件 48677 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\011.txt
文件 59885 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\012.txt
文件 83961 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\013.txt
文件 18001 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\014.txt
文件 56667 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\015.txt
文件 46281 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\016.txt
文件 19140 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\017.txt
文件 927 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\018.txt
文件 25315 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\019.txt
文件 69307 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\020.txt
文件 31614 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\021.txt
文件 108668 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\022.txt
文件 51053 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\023.txt
文件 56308 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\024.txt
文件 62732 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\025.txt
文件 156487 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\026.txt
文件 79803 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\027.txt
文件 20557 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\028.txt
文件 1594 2007-08-28 22:44 Idiom\Idiom\bin\Debug\Idiom\029.txt
............此处省略46个文件信息
- 上一篇:C#超级通信调试工具源码20130916
- 下一篇:C#图书管理系统三层架构
相关资源
- C# TIP文件生成和拆解
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
评论
共有 条评论