static void Main(string[] args) //Se realizo una clase por cada cuerpo para una mejor estructura { int opc; do //Ciclo do-while para repetir el proceso { Console.Clear(); Console.WriteLine("~ BlackJack ~"); Console.WriteLine("Iniciando con carta:"); Game obj = new Game(); //Creamos un objeto de la clase Game obj.Play(); //Llamamos al método Play a través del objeto obj Console.ReadKey(); Console.Clear(); Console.WriteLine("¿Quieres seguir jugando?\n1.-Si\n2.-No"); Console.Write("Opción: "); opc = int.Parse(Console.ReadLine()); } while (opc == 1); }
public static void Main(string[] args) { Console.WriteLine("Welcome to C# BlackJack"); while (true) { Game game = new Game(); game.Play(); Console.WriteLine("Play again? (Y/N): "); ExitQuery: switch (Console.ReadLine().ToUpper()) { case "Y": break; case "N": return; default: Console.WriteLine("Invalid input."); goto ExitQuery; } } }
static void Main(string[] args) { Game game = new Game(); game.Play(); }