usando el sistema;
utilizando System.Collections.Generic;
utilizando System.Linq;
usando System.Text;
usando System.Threading.Tasks;
espacio de nombres capítulo02
{ class Menu { public static void Main (string [] args) { // Inicializar el objeto Computer [] com = new Computer [3]; Computer com1 = new Computer (); com1.Type = "hpCQ-217TX" ; com1.BuyDate = "2013-10-5"; com [0] = com1; Computadora com2 = nueva computadora (); com2.Type = "Mc240CH / A"; com2.BuyDate = "2013-10-5"; com [1] = com2; Computadora com3 = nueva Computadora (); com3.Type = "SYNW18H / W"; com3.BuyDate = "2013-10-5"; com [2] = com3; Console.WriteLine (" Establecer subir ID de computadora antes de *** "); Console.WriteLine (" modelo de computadora \ t ID de computadora \ t hora de compra ");
for (int i = 0; i <com.Length; i ++)
{ Console.WriteLine ("{0} \ t \ t \ t {1}", com [i] .Type, com [i] .BuyDate); }
Console.WriteLine("加上计算机id后");
Ran rr = new Ran();
rr.getid(com);
Console.WriteLine("***************设置计算机ID后******************");
Console.WriteLine("计算机型号\t计算机ID\t购买时间");
for (int i = 0; i < com.Length ; i++)
{
Console.WriteLine("{0}\t{2}\t\t{1}", com[i].Type, com[i].BuyDate,com[i].ID);
}
}
}
}
usando el sistema;
utilizando System.Collections.Generic;
utilizando System.Linq;
usando System.Text;
usando System.Threading.Tasks;
espacio de nombres Chapter02
{ public class Ran { public void getid (Computer [] com) { Random aleatorio = new Random ();
for (int i = 0; i < com.Length; i++)
{
com[i].ID = com[i].Type + "-" + rand.Next(1000, 9999);
int a = rand.Next(1000,10000);
}
}
}
}
usando el sistema;
utilizando System.Collections.Generic;
utilizando System.Linq;
usando System.Text;
usando System.Threading.Tasks;
espacio de nombres Chapter02
{ public class Computer { public string Type; // Model public string ID; // id public string BuyDate; // Fecha de compra
}
}