• 结构体


      //结构体 定义自己的类型my tape

                //在main括号外面加public stuct **  **为自己的类型  下边加大括号  括号里是自己的类型里面包括的对象

                //在里边写 public +类型+变量名   类型里面可以加自己创建的类型  

                //把 中间的class 去掉,新添加的其他新建项也可以用 这个类型

                //例

     

                 /*

                 public struct snakepoint

                 {

                     public int x;

                     public  int y;

                 }

               public  struct student

                      {

                          public int 学号;

                          public string 名字;

                          public int csharp;

                          public int 网页;

                          public int 数据库;

                          public int 总分;

                          public int 名次;

                          public snakepoint 坐标;

                       }

     

              

                     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);

                */

              

     

     

     

     

                //输入学生信息并成绩排名

                /*

                //输入部分  加求总成绩

                Console.WriteLine("请输入信息:");

                 student []a=new student [5];

                for (int i = 0; i < 5;i++ )

                {

                    a[i].学号 =i+1;

                    Console.Write("输入名字:");

                    a[i].名字 = Console.ReadLine();

                    Console.Write("输入c#成绩:");

                    a[i].csharp = Convert.ToInt32(Console.ReadLine());

                    Console.Write("输入网页成绩:");

                    a[i].网页 = Convert.ToInt32(Console.ReadLine());

                    Console.Write("输入数据库成绩:");

                    a[i].数据库 = Convert.ToInt32(Console.ReadLine());

                  

                    a[i].总分 = a[i].csharp + a[i].数据库 + a[i].网页;

                  

                } 

                

                

                //根据总分排名

                for (int i = 0; i < 5; i++)

                {

                    for (int m = 0; m < i; m++)

                    {

                        if (a[m].总分 < a[i].总分)

                        {

                            student n = a[m];

                            a[m] = a[i];

                            a[i] = n;

                        }

                       

                    }

                 

                }

                 //输出部分

                Console.WriteLine("学号 姓名 c# 网页 数据库 总分 名次");

                for (int i = 0; i < 5;i++ )

                {

                    a[i].名次 = i + 1;

                    Console.WriteLine(a[i].学号 +" "+a[i].名字 +" "+a[i].csharp+" "+a[i].网页+" "+a[i].数据库+" "+a[i].总分+" "+a[i].名次);

                }

     

                */

  • 相关阅读:
    打印当前系统内存使用情况
    swagger 相关
    乐观锁
    mybatis-plus
    kt connect
    flyway
    k8s mandatory.yaml & service-nodeport.yaml
    kubernetes的DNS解析,k8s的DNS解析,service DNS解析,在集群内部通过 Service 的域名形式进行互相通信
    k8s中引入外部服务,k8s中引入外部数据源
    docker 访问外部数据库
  • 原文地址:https://www.cnblogs.com/wanwuguizong/p/3939336.html
Copyright © 2020-2023  润新知