using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Day02_04
{
class Computer
{
public string type;
public int num;
public string date;
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Day02_04
{
class Program
{
static void Main(string[] args)
{
Computer computer = new Computer();
Computer[] com = new Computer[3];
com[0] = new Computer();
com[0].type = "hpCQ-217TX";
com[0].date = "2013-10-5";
com[1] = new Computer();
com[1].type = "Mc240CH/A";
com[1].date = "2013-10-5";
com[2] = new Computer();
com[2].type = "SYNW18H/W";
com[2].date = "2013-10-5";
Console.WriteLine("***************设置计算机id前**************");
Console.WriteLine("计算机型号\t计算机id\t购买时间");
for (int i = 0; i < com.Length; i++)
{
Console.WriteLine(com[i].type + "\t\t\t" + com[i].date);
}
Random ran = new Random();
com[0].num = ran.Next(1000, 9999);
com[1].num = ran.Next(1000, 9999);
com[2].num = ran.Next(1000, 9999);
Console.WriteLine("**************设置计算机id后***************");
Console.WriteLine("计算机型号\t计算机id\t购买时间");
for (int i = 0; i < com.Length; i++)
{
Console.WriteLine(com[i].type + "\t" + com[i].type + "-" + com[i].num + "\t" + com[i].date);
}
Console.ReadLine();
}
}
}
生成计算机ID
最新推荐文章于 2024-05-10 18:13:22 发布