标签:
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SL1 { class Program { public struct Student { public int _id; public int _age; public void Show() { Console.WriteLine("ID:{0}\n年龄:{1}", _id, _age); } } static void Main(string[] args) { Student stu; stu._id = 1001; stu._age = 20; stu.Show(); //int[] infozhang = new int[] { 170, 60 }; //int[] infoLi = new int[2]; //Console.WriteLine("复制前-----李明德身高为:" + infozhang[0] + "体重是:" + infoLi[1]); //for (int i = 0; i < infozhang.Length;i++ ) //{ // infoLi[i] = infozhang[i]; //} //Console.WriteLine("去年张浩的身高为:" + infozhang[0] + "体重是:" + infozhang[1] + ",李明的身高为:" + infoLi[0] + "体重是:" + infoLi[1]); //infoLi[0] = 180; //infoLi[1] = 70; //Console.WriteLine("今年张浩的身高为:" + infozhang[0] + "体重是:" + infozhang[1] + ",李明的身高为:" + infoLi[0] + "体重是:" + infoLi[1]); //int[] infozhang = new int[] { 170,60}; //int[] infoLi = infozhang; //Console.WriteLine("去年张浩的身高为:"+infozhang [0]+"体重是:"+infozhang [1]+",李明的身高为:"+infoLi[0]+"体重是:"+infoLi[1]); //infoLi [0]=180; //infozhang[1] = 70; //Console.WriteLine("今年张浩的身高为:" + infozhang[0] + "体重是:" + infozhang[1] + ",李明的身高为:" + infoLi[0] + "体重是:" + infoLi[1]); //int heightZhang = 170; //int heightli = heightZhang; //Console.WriteLine("去年李明的身高为:"+heightli +"去年张浩的身高为:"+heightZhang); //heightli = 180; //Console.WriteLine("今年李明的身高为:" + heightli + "今年张浩的身高为:" + heightZhang); Console.ReadLine(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Student { class Program { static void Main(string[] args) { int[] points = new int[5]; int[] newpoints = new int[5]; Console.WriteLine("请输入5位会员的积分"); 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("{0}\t{1}\t{2}",(i+1),points[i] ,newpoints[i]); } Console.ReadLine(); //int i = 123; //object o = i; //i = 456; //int i = 123; //object o = i; //int j=(int)o; //Console.WriteLine("值类型的值为:{0}",i); //Console.WriteLine("引用类型的值为:{0}",j); //Console.ReadLine(); } } }
标签:
原文地址:http://www.cnblogs.com/WuXuanKun/p/5317161.html