文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>桃心代码

桃心代码

时间:2011-06-03  来源:Mr_wen

Console.WriteLine("请问你需要多大的桃心:");
            int a = Convert.ToInt32(Console.ReadLine());
            if (a % 2 == 1) { a += 1; }
            int x = a / 2;
            for (int i = x / 2; i < a; i++)
            {
                for (int j = 1; j < a; j++)
                {
                    if (((i + j == x + 1 || j - i == x - 1) || (i == j || i + j == a)) && i > x / 2 && i <= x) { Console.Write((char)3+" "); }
                    else if (i - j == x - 1 || j + i == 3 * x - 1)
                    {
                        Console.Write((char)3 + " ");
                    }
                    else
                    {
                        Console.Write("  ");
                    }
                }
                Console.WriteLine();
            }

            Console.WriteLine("\n");

            int y = a / 4;
            for (int i = 1; i < a; i++)
            {
                for (int j = 1; j < a; j++)
                {
                    if (((j > y - i && j <= y + i - 1) || (j > 3 * y - i && j <= 3 * y + i - 1)) && i <= y + 1)
                    {
                        if (i == 1 && (j == y || j == 3 * y)) { Console.Write("  "); }
                        else { Console.Write((char)3 + " "); }
                    }
                    else if (i > y + 1 && (j < a - i + y + 6 && j > i - y - 6)) { Console.Write((char)3+" "); }

                    else { Console.Write("  "); }
                }
                Console.WriteLine();
            }

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载