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();
    }
    }
    }

  • 相关阅读:
    iOS中图片与视频一次性多选
    UIImagePickerController Class
    1月16日
    10月20日
    1月14日
    1月13日
    1月12日
    1月11日
    课程评价与建议
    加分总结
  • 原文地址:https://www.cnblogs.com/kexb/p/4875994.html
Copyright © 2011-2022 走看看