From aryx, 6 Years ago, written in C#.
Embed
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.CompilerServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7.  
  8. // omae wa...
  9. // mou shindeiru!
  10.  
  11. namespace Matrixos
  12. {
  13.     class Matrix
  14.     {
  15.         private int cnt;
  16.         private int[,] arr;
  17.  
  18.         public Matrix()
  19.         {
  20.             do
  21.             {
  22.                 Console.WriteLine("Hanyszor hanyas matrix ko? -> ");
  23.                 cnt = int.Parse(Console.ReadLine());
  24.             } while (cnt<1);
  25.  
  26.             arr = new int[cnt,cnt];
  27.  
  28.             // fültöltés
  29.             for (int i = 0; i < cnt; i++)
  30.             {
  31.                 for (int j = 0; j < cnt; j++)
  32.                 {
  33.                     if (i == j)
  34.                     {
  35.                         arr[i, j] = 1;
  36.                     } else if (i > j)
  37.                     {
  38.                         arr[i, j] = 3;
  39.                     }
  40.                     else
  41.                     {
  42.                         arr[i, j] = 2;
  43.                     }
  44.                 }
  45.             }
  46.         }
  47.  
  48.  
  49.         void Kiir()
  50.         {
  51.             for (int i = 0; i < cnt; i++)
  52.             {
  53.                 for (int j = 0; j < cnt; j++)
  54.                 {
  55.                     Console.Write("{0},3", arr[i,j]);
  56.                 }
  57.                 Console.WriteLine();
  58.             }
  59.         }
  60.     }
  61. }
  62.