首页 > 学院 > 开发设计 > 正文

上机练习1-2

2019-11-11 05:22:39
字体:
来源:转载
供稿:网友
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace day02{    class PRogram    {        static void Main(string[] args)        {            int [] points =new int [5];            int[] newpoints = new int[5];            Console.WriteLine("请输入五位会员的积分");            for (int i = 0; i < points.Length; i++)            {                Console.Write("第"+(i+1)+"位会员积分");                points[i] = Convert.ToInt32(Console.ReadLine());            }            for (int i = 0; i < points.Length; i++)            {                newpoints[i] = points[i];                newpoints[i] = newpoints[i] + 500;            }            Console.WriteLine("/n 序号      历史积分      新年积分");            for (int i = 0; i < points.Length; i++)            {                Console.WriteLine((i+1)+"           "+points[i]+"           " +newpoints[i]+"         "       );            }            Console.WriteLine("上机一    二分界线------------------------------------------------------------------------");            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();        }    }}
using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace day02{    class computer    {        public string type;        public int num;        public string date;    }}


发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表