资源简介

Visual Studio工程,成语接龙例子,源代码,感兴趣的可以下载看一下

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace 成语接龙
{
    /// 
    /// 成语接龙引导打出称霸天下
    /// 

    class Program
    {
        static List listAll = new List();//全部成语
        static List listOld = new List();//已经答过的成语列表
        static List list = new List();//成语总列表
        static List listC = new List();//最后一位是称的

        static List> listCAll = new List>();//成语分层后存储集合
        static void Main(string[] args)
        {
            Console.WriteLine(“加载字典库。。。“);
            Load(5);
            Console.WriteLine(“加载完成请输入成语“);
            while (true) {
                string str = Console.ReadLine();
                if (str.Length != 4)
                {
                    Console.WriteLine(“请输入正确的成语“);
                }
                else
                {
                    string all = listAll.Where(u => u == str).FirstOrDefault();
                    if (string.IsNullOrEmpty(all))
                    {
                        Console.WriteLine(“您输入的成语字典库中找不到,请确认输入“);
                    }
                    else
                    {

                        if (str == “称霸天下“)
                        {
                            Console.WriteLine(“您输了“);
                        }
                        else
                        {
                            if (listOld.Count >= 1)
                            {
                                string first = str.Substring(0 1);
                                string s1 = listOld.Where(u => u == str).FirstOrDefault();//判断成语是否输入过
                                if (string.IsNullOrEmpty(s1))
                                {
                                    string end = listOld[listOld.Count - 1].Substring(3 1);////判断输入的成语是不是最后一个的头
                                    if (first != end)
                                    {
                                    

                                        Console.WriteLine(“请输入正确的接龙,上一个成语是:“ + listOld[listOld.Count - 1]);
                                    }
                                    else
                                    {
                                        string s = Solitaire(str);
                                        listOld.Add(s);
                                        Console.WriteLine(s);
                                    }
                                }
                                else
                                {
                                    Console.WriteLine(“该成语已经输入过了,上一个成语是:“ + listOld[listOld.Count - 1]);
                                }
                            }
                            else {
                                string s = Solitaire(str);
                                listOld.Add(s);
                  

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-06-30 09:26  成语接龙\
     目录           0  2015-06-30 09:30  成语接龙\成语接龙\
     文件        6181  2015-06-30 10:42  成语接龙\成语接龙\Program.cs
     目录           0  2015-06-30 09:26  成语接龙\成语接龙\Properties\
     文件        1374  2015-06-30 09:26  成语接龙\成语接龙\Properties\AssemblyInfo.cs
     目录           0  2015-06-30 09:26  成语接龙\成语接龙\bin\
     目录           0  2015-06-30 09:38  成语接龙\成语接龙\bin\Debug\
     文件      188297  2015-06-30 10:32  成语接龙\成语接龙\bin\Debug\data.txt
     文件        8192  2015-06-30 10:41  成语接龙\成语接龙\bin\Debug\成语接龙.exe
     文件       22016  2015-06-30 10:41  成语接龙\成语接龙\bin\Debug\成语接龙.pdb
     文件       11600  2015-06-30 10:42  成语接龙\成语接龙\bin\Debug\成语接龙.vshost.exe
     文件         490  2012-06-06 02:06  成语接龙\成语接龙\bin\Debug\成语接龙.vshost.exe.manifest
     文件      188297  2015-06-30 10:32  成语接龙\成语接龙\data.txt
     目录           0  2015-06-30 09:26  成语接龙\成语接龙\obj\
     目录           0  2015-06-30 09:26  成语接龙\成语接龙\obj\x86\
     目录           0  2015-06-30 10:41  成语接龙\成语接龙\obj\x86\Debug\
     文件        6032  2015-06-30 10:41  成语接龙\成语接龙\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     目录           0  2015-06-30 10:43  成语接龙\成语接龙\obj\x86\Debug\TempPE\
     文件         325  2015-06-30 10:42  成语接龙\成语接龙\obj\x86\Debug\成语接龙.csproj.FileListAbsolute.txt
     文件        8192  2015-06-30 10:41  成语接龙\成语接龙\obj\x86\Debug\成语接龙.exe
     文件       22016  2015-06-30 10:41  成语接龙\成语接龙\obj\x86\Debug\成语接龙.pdb
     文件        2637  2015-06-30 09:38  成语接龙\成语接龙\成语接龙.csproj
     文件         878  2015-06-30 09:26  成语接龙\成语接龙.sln
     文件      132608  2015-06-30 09:50  成语接龙\成语接龙.suo

评论

共有 条评论