3
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Testes
{
class Program
{
static void Main(string[] args)
{
int[] ticket = new int[5];
string[] nome = new string[5];
for(int i = 1; i < 6; i++)
{
Console.WriteLine("Bem vindo, digite seu nome: ");
ticket[i] = i;
nome[i] = Console.ReadLine();
Console.WriteLine("Ticket número {0} do Sr. {1}", ticket[i], nome[i]);
Console.WriteLine("Pressione Enter");
}
Console.ReadKey();
}
}
}
The error that appears is:
An unhandled Exception of type 'System.Indexoutofrangeexception' occurred in Testes.exe
The error occurs on the first run or correctly executes an x of iterations?
– Leonel Sanches da Silva