using System; using System.Collections.Generic;
namespace MATRIX_algebra
{
public struct Struct_matrix
{
List<List<double>> entries;
public Struct_matrix(List<List<double>> values)
{
entries = values;
}
}
// public delegate void process_matrix(Struct_matrix matrix);
public class Matrix_init
{
public int size_C, size_R;
public void matrix_size()
{
Console.WriteLine("Enter the size of the matrix ");
Console.WriteLine("rows? ");
this.size_R = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("columns? ");
this.size_C = Convert.ToInt32(Console.ReadLine());
}
public List<List<double>> values = new List<List<double>>();
public void matrix_value()
{
for (int i = 0; i < this.size_R; i++)
{
Console.WriteLine("Enter the entries of the {0} row ",i+1);
for (int j = 0; j < this.size_C; j++)
{
values[i][j] = Convert.ToDouble(Console.ReadLine());
}
}
Struct_matrix matrix_init = new Struct_matrix(values);
}
}
}
namespace test
{
using MATRIX_algebra;
public class test_values
{
static void Main()
{
Matrix_init matrix1 = new Matrix_init();
for (int i = 0; i < matrix1.size_R; i++)
{
for (int j = 0; j < matrix1.size_C; j++)
{
Console.WriteLine(matrix1.values[i][j]);
}
}
}
}
}
I feel so dumb with this question, but I really need help since I'm just beginner
I don't know why when I run the program, it doesn't run through some parts of the code.
I debugged it, Main() -> instantiate Matrix_init ->public List> values = new List>(); -> end the program.