占位符和+号的用法(两个练习)

            string strName = "kakaxi";
            string strVillage = "huoyingcun";
            int iAge = 20;
            string strEmail = "1287195315@qq.com";
            decimal deSalary = 2000m;
            Console.WriteLine("大家好,我叫"+strName+",我今年"+iAge+"岁了, 我住在"+strVillage+",我的邮箱是"+strEmail+", 我的工资有足足"+deSalary+"元;");
            Console.ReadKey();

 

            string strName = "kakaxi";
            string strVillage = "huoyingcun";
            int iAge = 20;
            string strEmail = "1287195315@qq.com";
            decimal deSalary = 2000m;
            Console.WriteLine("大家好,我叫{0},我今年{1}岁了, 我住在{2},我的邮箱是{3}, 我的工资有足足{4}元;", strName, iAge, strVillage, strEmail, deSalary); ;
            Console.ReadKey();
        static void Main(string[] args)
        {
            string strName = "zhangsan";
            char chGender = '';
            int intAge = 10;
            string strTel = "13486484826";
            Console.WriteLine("你好, 我叫{0}, 我是{1}生, 我今年{2}岁了,我的电话号码是{3};", strName, chGender, intAge, strTel);
            Console.ReadKey();
        }

 

        static void Main(string[] args)
        {
            string strName = "zhangsan";
            char chGender = '';
            int intAge = 10;
            string strTel = "13486484826";
            Console.WriteLine("你好, 我叫"+strName+", 我是"+chGender+"生, 我今年"+intAge+"岁了,我的电话号码是"+strTel+";");
            Console.ReadKey();
        }

 

posted @ 2024-08-09 21:14  CSF践行  阅读(7)  评论(0编辑  收藏  举报