C sharp - Array que permita ingresar y mostrar datos de 5 clientes

 
Vista:

Array que permita ingresar y mostrar datos de 5 clientes

Publicado por Omar Andres Gutierrez (1 intervención) el 16/03/2015 03:27:04
Buenas Noches,

Espero puedan ayudarme. Si me pueden colaborar les estare muy agradecido.

Lo que pasa es lo siguiente tengo que hacer un programa de consola en C# mediante Array el cual capture los datos de 5 Clientes y despues me los muestre, esto unicamente con Array.

He hecho alguans pruebas pero aun no he podido realizarlo me podrian asesorar o ayudar en este tema por favor.

Muchisimas Gracias.





using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Clientes;

namespace ConsolaArray
{
public class Consola
{
static void Main(string[] args)
{
int i = 0;
Cliente[] Clientes;
Clientes = new Cliente[5];
for (i = 0; i < Clientes.Length; i++);
{
Cliente temporal = new Cliente();
Console.WriteLine("Escriba los datos del cliente: ");
temporal.nombre = Convert.ToString(Console.ReadLine());
temporal.identificacion = Convert.ToString(Console.ReadLine());
temporal.telefono = Convert.ToString(Console.ReadLine());

Console.WriteLine(temporal.nombre + temporal.identificacion + temporal.telefono);
}


}
}
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil

Array que permita ingresar y mostrar datos de 5 clientes

Publicado por Rene gar (6 intervenciones) el 16/03/2015 18:45:00
Te dejo esta version

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
namespace lawebdelprogramador
{
    class Cliente
    {
        private string nombre;
        private long  telefono;
        private string indentificacion;
 
 
        public string Nombre{
            set {
                this.nombre = value;
 
            }
 
            get {
 
                return this.nombre;
            }
 
        }
 
 
        public long Telefono {
 
            set {
                this.telefono = value;
            }
 
            get {
 
                return this.telefono;
            }
        }
 
 
        public string Indentificacion {
 
            set {
                this.indentificacion = value;
            }
 
            get {
 
                return this.indentificacion;
            }
 
        }
 
 
        static void Main(string[] args)
        {
            Cliente[] clientes = new Cliente[5];
            Cliente objeto = null;
 
            for (int i = 0; i < clientes.Length; i++) {
 
                objeto=new Cliente();
                Console.WriteLine("Escriba su nombre");
                objeto.Nombre =Convert.ToString( Console.ReadLine());
 
                Console.WriteLine("Escriba su indentifiacion");
                objeto.Indentificacion =Convert.ToString( Console.ReadLine());
 
                Console.WriteLine("Escriba su telefono");
                objeto.Telefono = long.Parse(Console.ReadLine());
 
                clientes[i]=objeto;
 
            }
 
 
            for (int i = 0; i < clientes.Length; i++) {
 
                Console.WriteLine("Nombre " + clientes[i].Nombre + " " + "indetificacion " + clientes[i].Indentificacion + " " +
                    "Telfono " + clientes[i].Telefono);
            }
 
            Console.ReadKey();
 
        }
 
 
    }
}
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar