zoukankan      html  css  js  c++  java
  • 结构体20140827

    1. 结构体 定义自己的类型my tape
    2. 在main括号外面加public stuct **  **为自己的类型  下边加大括号  括号里是自己的类型里面包括的对象
    3. 在里边写 public +类型+变量名   类型里面可以加自己创建的类型 
    4. 把 中间的class 去掉,新添加的其他新建项也可以用 这个类型
    public struct snakepoint
            {
                public int x;
                public int y;
            }
            static void Main(string[] args)
            {
                snakepoint s = new snakepoint();
                s.x = 5;
                s.y = 10;
    
                ArrayList a = new ArrayList();
                a.Add(s);
    
    
                Console.WriteLine((snakepoint )a[0].x+","+((snakepoint)a[0]).y);
            {
                student lch = new student();
                lch.no = 1;
                lch.name = "xxx";
                lch.Cshap = 90;
                lch.web = 78;
                lch.datebase = 83;
                lch.sum = lch.Cshap + lch.web + lch.datebase;
                Console.WriteLine(("学号·{0}姓名·{1}Cshap·{2}web·{3}datebase·{4}总分·{5}"), lch.no, lch.name, lch.Cshap, lch.web, lch.datebase, lch.sum);
            }
            
                    
            struct student
            {
                public int no;
                public string name;
                public int Cshap;
                public int web;
                public int datebase;
                public int sum;
            }

      

  • 相关阅读:
    favicon.ico请求处理
    Node.js学习(Node.js基础)
    实现主机访问虚拟机网页的方法总结
    有向/无向图中搜环
    后缀自动机
    莫队算法
    A* 算法求第k短路径
    次小生成树算法
    AC自动机详解
    Link-Cut-Tree详解
  • 原文地址:https://www.cnblogs.com/jackjms/p/3939530.html
Copyright © 2011-2022 走看看