9X9矩阵

来源:互联网 发布:dnf登录网络连接中断 编辑:程序博客网 时间:2024/06/11 19:30
  1. //      
  2. // Copyright (c) 2014软件技术1班      
  3. // All rights reserved.       
  4. // 作    者:A08梁运基       
  5. // 完成日期:2014年 11 月 23 日       
  6. // 版 本 号:v1.0       
  7. //       
  8. // 问题描述:创建一个程序来显示9X9矩阵。      
  9. // 输入描述:       
  10. // 程序输出:一个矩阵,里面的“1”成“X”形。
  11. //       
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace 二维
{
    class Program
    {
        static void Main(string[] args)
        {
            int[,] x = new int[9, 9];
            for (int i = 0; i < 9; i++)
            {
                for (int j = 0; j <9; j++)
                {


                    if (j == i)
                        x[i, j] = 1;
                    else if (j == 8 - i)
                        x[i, j] = 1;
                    Console.Write(" {0} " ,  x[i,  j]);
                }
                Console.WriteLine( );
            }


            Console.Read( );
        }

        


不足之处,大神多多点评哦大笑大笑

0 0
原创粉丝点击