zoukankan      html  css  js  c++  java
  • 聊天机器人

    无聊写个聊天机器人玩玩,感觉还是挺有趣的

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace 聊天机器人
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("你好,我是机器人");
                while (true)
                {
                    string str = Console.ReadLine();
                    if (str.Contains("姓名") || str.Contains("名字") || str.Contains("叫"))
                    {
                        Console.WriteLine("你好,我的名字是小罗");
                    }
                    else  if (str.Contains("性别") || str.Contains("男") || str.Contains("女"))
                    {
                        Console.WriteLine("你好,我是男的");
                    }
                    else if (str.Contains("年龄") || str.Contains("多大"))
                    {
                        Console.WriteLine("我刚满2周岁");
                    }
                    else if (str.Contains("生日") || str.Contains("出生"))
                    {
                        Console.WriteLine("我的生日是2010年1月1日");
                    }
                    //天气
                    else if(str.Contains("天气"))
                    {
                        string city = str.Substring(0,2);
                        Console.WriteLine("{0}整天下雨",city);
                    }
                    else if (str.Contains("fuck") || str.Contains("shit") || str.Contains("擦"))
                    {
                        Console.WriteLine("fuck you!!");
                    }
                    else if(str.Contains("love")||str.Contains("喜欢")||str.Contains("爱"))
                    {
                        Console.WriteLine("I love you too");
                    }
                    else if (str.Contains("再见") || str.StartsWith("88") || str.Contains("bye"))
                    {
                        Console.WriteLine("撒有那拉");
                    }
                   
                }
                Console.ReadKey();
            }
        }
    }
    

      

    清晨の雨露:One step one footprint
  • 相关阅读:
    jquery 学习笔记
    session
    六、线程中断机制
    二、CompletableFuture(一)基础概念
    四、常见的锁
    五、synchronized细节
    三、CompletableFuture(二)常见用法
    七、等待唤醒的三种方式
    序列化 和 反序列化
    Trigger
  • 原文地址:https://www.cnblogs.com/zhmt/p/2406115.html
Copyright © 2011-2022 走看看