NO.5聊天机器人小试成功(模仿)

    技术2025-02-09  17

    using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace 聊天机器人 { class Program { static void Main(string[] args) { Console.WriteLine("您好,我是聊天机器人 ^_^ "); int fulllevel = 5; while(true) { String str=Console.ReadLine(); if (fulllevel <= 0) { Console.WriteLine("我饿了,不聊了 吼吼 o(╯□╰)o"); string strfood = Console.ReadLine(); int food = Convert.ToInt32(strfood); if (food <= 0) { Console.WriteLine("我饿了,快给我点东西吃啊 吼吼 o(╯□╰)o"); return; } if (food > 10) { Console.WriteLine("撑死了 吼吼 挂了"); return; } continue; } if (str=="今天天气怎么样?") { Console.WriteLine("今天天气不错!"); } else if(str=="适合做什么运动") { Console.WriteLine("打篮球或踢足球 ^_^"); } else if (str == "你是学生吗?") { Console.WriteLine("小学生 ^_^"); } else if (str == "88") { Console.WriteLine("886 ^_^"); return; } else { Console.WriteLine("对不起,您说的意思我不懂 ^_^"); } fulllevel--; } Console.ReadKey(); } } }

    今夜可以睡个好觉了 ^_^

    最新回复(0)