标签:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Collections; namespace 结构体__练习 { class Program { struct worker { public string name; public string age; public string gongzi; } static void Main(string[] args) { worker worker = new worker(); worker.name = " 刘杰 "; worker.age = " 27 "; worker.gongzi = " 2100 "; worker worker1 = new worker(); worker1.name = " 刘亮 "; worker1.age = " 25 "; worker1.gongzi = " 2500 "; worker worker2 = new worker(); worker2.name = " 刘琦 "; worker2.age = " 23 "; worker2.gongzi = " 2700 "; worker worker3 = new worker(); worker3.name = " 刘明 "; worker3.age = " 20 "; worker3.gongzi = " 2300 "; ArrayList NUM = new ArrayList(); NUM.Add(worker.name+ worker.age+ worker.gongzi); NUM.Add(worker1.name + worker1.age + worker1.gongzi); NUM.Add(worker2.name + worker2.age + worker2.gongzi); NUM.Add(worker3.name + worker3.age + worker3.gongzi); Console.WriteLine(" 姓名 年龄 工资 "); foreach (string v in NUM) { Console.WriteLine("" + v); } Console.WriteLine(""); Console.ReadLine(); } } }
标签:
原文地址:http://www.cnblogs.com/hanke123/p/4725523.html