elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Usando Git para manipular el directorio de trabajo, el índice y commits (segunda parte)


  Mostrar Temas
Páginas: [1]
1  Programación / .NET (C#, VB.NET, ASP) / Eliminar dato de matriz y array en: 29 Junio 2017, 16:28 pm
Hola, hice este metodo:

Código
  1. static bool eliminar(int[] lista, string[] nombre, string nom, ref int tope) //ELIMINAR EN UN ARRAY
  2.        {
  3.  
  4.            Console.WriteLine("\t\t3 - Elimine una apuesta: ");
  5.            Console.WriteLine();
  6.            Console.Write("Ingrese Nombre del Cliente: ");
  7.            nom = Console.ReadLine().ToUpper().Trim();
  8.            bool e = false;
  9.            for (int i = 0; i < tope; i++)
  10.            {
  11.                if (nom == nombre[i])
  12.                {
  13.                    for (int j = i; j < tope - 1; j++)
  14.                    {
  15.                        lista[j] = lista[tope - 1];
  16.                        nombre[j] = nombre[j - 1];
  17.                        tope--;
  18.                        e = true;
  19.                        i = tope;
  20.                    }
  21.                }
  22.            }
  23.            return e;
  24.        }




invoco en el main asi:


Código
  1. case 3:
  2.                        Console.WriteLine("\t\t3-Eliminar Apuesta");
  3.  
  4.                        eliminar(vector, nombre,  ref  tope);//ACA ME DA ERROR NO SE COMO LLAMARLO
  5.  
  6.                        break;



no se porque no puedo incovarlo me da error de argumentos y tampoco se si el codigo es el correcto


el resto del main es este


Código
  1. string[] nombre;
  2.  
  3.            int opcion, tope = 0, cantidad;
  4.            bool seguir = true;
  5.            Console.WriteLine("cantidad de apostantes: ");
  6.  
  7.            cantidad = Convert.ToInt32(Console.ReadLine());
  8.            int[] vector = new int[cantidad];
  9.            nombre = new string[cantidad];
  10.            int[,] matriz = new int[cantidad, 5];
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines