Mail.ruПочтаМой МирОдноклассникиВКонтактеИгрыЗнакомстваНовостиКалендарьОблакоЗаметкиВсе проекты

Ошибка CS1519 c#

mopoiop Opop Ученик (7), на голосовании 9 месяцев назад
using System;
using System.Numerics;

class Matrix
{
private readonly int[,] matrix;
private readonly int rows;
private readonly int cols;

public Matrix(int rows, int cols)
{
this.rows = rows;
this.cols = cols;
matrix = new int[rows, cols];
Random rand = new();
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
matrix[i, j] = rand.Next (1, 101);
}
}
}

public void Print()
{
Console.WriteLine("Matrix:");
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
Console.Write(matrix[i, j] + "t");
}
Console.WriteLine();
}
}

public int Max()
{
int max = matrix[0, 0];
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
if (matrix[i, j] > max)
{
max = matrix[i, j];
}
}
}
return max;
}

public int Min()
{
int min = matrix[0, 0];
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
if (matrix[i, j] < min)
{
min = matrix[i, j];
}
}
}
return min;
}

public void Info()
{
Console.WriteLine("Matrix [{0}x{1}]", rows, cols);
Console.WriteLine("Max element: {0}", Max());
Console.WriteLine("Min element: {0}", Min());
}
}

class Program
{
static void Main(string[] args)
{
if (args is null)
{
throw new ArgumentNullException(nameof(args));
}

Matrix matrix = new(3, 4);
matrix.Print();
matrix.Info();
}
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"классы/1.0.0": {
"runtime": {
"классы.dll": {}
}
}
}
},
"libraries": {
"классы/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}
Голосование за лучший ответ
Дмитрий Мыслитель (6559) 10 месяцев назад
проект заново пересоздавай
Похожие вопросы