接收用户的输入

        static void Main(string[] args)
        {
            Console.WriteLine("美女,你喜欢吃什么水果?");
            string strFruit = Console.ReadLine();//接收用户输入的字符串;
            Console.WriteLine("这么巧吗,我也喜欢吃" + strFruit + ";"); Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Console.WriteLine("请输入您的姓名:");
            string strName = Console.ReadLine();
            Console.WriteLine("请输入您的年龄:");
            int intAge = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("请输入您的性别:");
            char chGender = Convert.ToChar(Console.ReadLine());
            Console.WriteLine("大家好,我叫{0},今年{1}岁了, 我是{2}生;", strName, intAge, chGender);
            Console.ReadKey();
        }

 

posted @ 2024-08-10 09:57  CSF践行  阅读(1)  评论(0编辑  收藏  举报