(5)

int renshu = 1;                  //用于储存人数

            Console.WriteLine("请输入用户数量:");

            string shuliang = Console.ReadLine();

            int number = Convert.ToInt32(shuliang);

            try

            {

                do

                {

                    Console.WriteLine("请输入第{0}位用户的信息", renshu);

                    Console.WriteLine("请输入用户编号(<4为整数>):");

                    string shuzi = Console.ReadLine();

                    int yonghubianhao = Convert.ToInt32(shuzi);

                    Console.WriteLine("请输入用户积分:");

                    string fenshu = Console.ReadLine();

                    int jifen = Convert.ToInt32(fenshu);

                    Console.WriteLine("请输入用户年龄:");

                    string age = Console.ReadLine();

                    int nianling = Convert.ToInt32(age);

                    if (nianling < 10)

                    {

                        Console.WriteLine("很抱歉,您的年龄不适合玩此游戏,过几年再来吧!");

                        Console.WriteLine(@"

此用户信息录入失败!");

                    }

                    else

                    {

                    Console.WriteLine("您录入的信息是:");

                    Console.WriteLine(@"用户编号:{0}    年龄:{1}    积分:{2}", yonghubianhao, nianling, jifen);

                    }

                    renshu++;

                }

                while (number>=renshu);

                Console.WriteLine(@"

                                    录入完毕!");

            }

            catch

            {

                Console.WriteLine("对不起,您输入的格式有误。程序退出!");

            }

            Console.ReadKey();

图片发自App

你可能感兴趣的:((5))