1
When I put fixed values in the size of the matrix I can fill it, but when I try to capture the values in matrices a message like this appears:
The index was outside the matrix boundaries
` int a = 0, b = 0;
double[ , ] test = new double[a , b];
Console.Write("Linha: ");
a = int.Parse(Console.ReadLine());
Console.Write("Coluna: ");
b = int.Parse(Console.ReadLine());
for (int i = 0; i < a; i++)
{
for (int j = 0; j < b ; j++)
{
Console.Write("Digite um valor: ");
test[i , j] = double.Parse(Console.ReadLine());
}
}
Console.WriteLine("\n\n ");
for (int i = 0; i < a; i++)
{
for (int j = 0; j < b; j++)
{
Console.Write(test[i, j] + " ");
}
Console.WriteLine(" ");
}
Console.ReadKey();`
Thank you very much, I did not find any tutorial that would teach this, thank you very much.
– Julho Justino
Because the ideal is not to follow tutors, it is to learn in a structured way. To understand everything that is taking place in the code is to gain knowledge step by step. And tutors are created to burn stages, which is bad for learning.
– Maniero
Thanks for the tip.
– Julho Justino