• .NET深入 c#数据类型2


    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}
    年龄:{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("
    序号  历史积分  新年积分");
                //省略代码循环输出两个年度的积分
                for (int i = 0; i < points.Length;i++ )
                {
                    Console.WriteLine("{0}	{1}	{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();
    
            }
        }
    }
  • 相关阅读:
    将十六进制的颜色字符串转为UIColor
    NSXMLParser读取XML文件并将数据显示到TableView上
    TouchJSON的简单使用
    NSJSONSerialization的简单用法
    Android 开发之修改 app 的字体大小(老人模式)
    android sqlite3:数据库操作
    设计模式-观察者模式(Observer Pattern)
    Android 7.0 介绍和适配问题
    Appium的安装和使用
    Android:使用 DownloadManager 进行版本更新,出现 No Activity found to handle Intent 及解决办法
  • 原文地址:https://www.cnblogs.com/WuXuanKun/p/5317161.html
Copyright © 2020-2023  润新知