The user pastes the values that will be saved into the vector and then displays those values. However the following error is occurring:
An unhandled exception of type 'System.IndexOutOfRangeException' occurred in vetoor.exe ".
My code looks like this:
namespace vetoor
{
class Program
{
static void Main(string[] args)
{
int[] vet = new int[3];
int i,a;
for (i = 0; i < vet.Length; i++)
{
Console.WriteLine("Digite o numero");
vet[i] = int.Parse(Console.ReadLine());
}
for(a=0; a<4; a++)
{
Console.WriteLine("{0}", vet[i]);
}
Console.ReadKey();
}
}
}