zoukankan      html  css  js  c++  java
  • 对称矩阵 一个简单的小把戏

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    namespace ConsoleApplication13
    {
    class Program
    {
    static void Main(string[] args)
    {
    while (true)
    {


    Console.WriteLine("请输入矩阵的秩!!");
    int M = int.Parse(Console.ReadLine());
    string[,] a = new string[M, M];
    Random r = new Random(System.Guid.NewGuid().GetHashCode());

    for (int i = 0; i < M; i++)
    {
    for (int j = i; j < M; j++)
    {
    a[i, j] = r.Next(1, 100).ToString();
    }
    }

    for (int i = 0; i < M; i++)
    {
    for (int j = 0; j < i; j++)
    {
    a[i, j] = a[j, i];

    }
    }

    for (int i = 0; i < M; i++)
    {
    for (int j = 0; j < M; j++)
    {
    if (a[i, j].ToString().Length == 1)
    {
    a[i, j] = "0" + a[i, j];
    }
    Console.Write(a[i, j] + " ");
    }
    Console.WriteLine();
    }
    }
    Console.ReadKey();
    }
    }
    }

  • 相关阅读:
    springcloud有哪些特征
    可变参数
    递归
    增强的for循环
    Scanner对象
    注释
    Markdown常见的样式语法
    副本机制
    消费者分区分配策略
    SpringMVC 登陆判断
  • 原文地址:https://www.cnblogs.com/kexb/p/4875994.html
Copyright © 2011-2022 走看看