コード例 #1
0
ファイル: MatrixClass.cs プロジェクト: smihaylovit/TelerikHW
    static void Main()
    {
        Console.Write("Length: ");
        int n = int.Parse(Console.ReadLine());

        Matrix FirstMatrix = new Matrix(n, n);
        Matrix SecondMatrix = new Matrix(n, n);

        //read the first matrix
        Console.WriteLine("Enter the elements for the first matrix");
        Enter(ref FirstMatrix, n);
        //read the second matrix
        Console.WriteLine("Enter the elements for the second matrix");
        Enter(ref SecondMatrix, n);

        //testing addition
        Console.WriteLine("Testing addition:");
        Console.WriteLine(FirstMatrix + SecondMatrix);  //test the toString
        //testing subtraction
        Console.WriteLine("Testing subtraction:");
        Console.WriteLine(FirstMatrix - SecondMatrix);  //test the toString
        //testing multiplication
        Console.WriteLine("Testing multiplication:");
        Console.WriteLine(FirstMatrix * SecondMatrix);  //test the toString
        //testing content accessing
        Console.WriteLine("Access element FirstMatrix[0:0]");
        Console.WriteLine(FirstMatrix.AccessElement(0,0));
    }