• C#复习


    namespace 总复习
    {
        class Program
        {
            struct student//定义一个叫student的结构体
            {
                public int code;//学号
                public string name;//姓名
                public double score;//分数
            }
    
    
    
    
            static void Main(string[] args)
            {
                //两个变量不通过中间变量进行值互换的方式
                //int a = 4;//0100
                //int b = 8;//1000
                ////1100   12    1100
                 
    
                //方式1,异或运算符   通过2进制的比较
                ////a ^= b;
                ////b ^= a;
                ////a ^= b;
    
    
                //方式2,算术运算符
                //a += b;
                //b = a - b;
                //a = a - b;
                //Console.WriteLine(a+"	"+b);
    
                //Console.ReadLine();
    
    
    
    
                //int[,] shuzu = new int[,]//循环输出数组里所有的元素
                //{
                //    {1,2},
                //    {3,4},
                //    {5,6}
                //};
    
                //for (int i = 0; i < 3; i++)
                //{
                //    for (int j = 0; j < 2; j++)
                //    {
                //        Console.Write(shuzu[i,j]+"	");
                //    }
                //    Console.WriteLine();
                //}
                //Console.ReadLine();
    
    
    
                //ArrayList al = new ArrayList();
                //Console.Write("请输入班级人数:");
                //int a = int.Parse(Console.ReadLine());
                //for (int i = 0; i < a; i++)
                //{
                //    student st = new student();
                //    Console.Write("请输入第{0}个人的姓名:",i+1);
                //    st.name = Console.ReadLine();
                //    Console.Write("请输入他的学号:");
                //    st.code = int.Parse(Console.ReadLine());
                //    Console.Write("请输入他的分数:");
                //    st.score = double.Parse(Console.ReadLine());
                //    al.Add(st);
                //}
                
    
    
    
    
    
                //int a = 1;
                //int b = 2;
                //int c=4, d = 5;
    
                //a = 8;
    
                //int a = 5;//关于++a和a++的区别
                //int b = ++a;
                //int c = a++;
    
                //++a;
                //a++;
    
                //int d = a < b ? 1 : 2;
    
                //a += b;//a=a+b;
    
                //string s = "hello";
                ////长度
                //int chang = s.Length;
                ////截取
                //string s1 = s.Substring(2);//llo
                //string s2 = s.Substring(1,3);//ell
                ////第一次出现索引
                //int index = s.IndexOf("a");//-1      没有
                ////最后一次c出现索引
                //int last = s.LastIndexOf("l");//3
    
                ////包含
                //bool b = s.Contains("o");//true
                ////是否以。。。开头
                //bool c = s.StartsWith("abc");//false
                ////是否以。。。结尾
                //bool d = s.EndsWith("o");//true
    
                ////替换
                //s.Replace("l","A");
                //Console.WriteLine(s.Replace("l", "A"));
                //Console.WriteLine(s);
    
                //Console.ReadLine();
    
    
    
                //Random ran = new Random();//随机数类的初始化
                //int a = ran.Next();
    
    
    
            }
        }
    }

    少量加入了一些个人注释

  • 相关阅读:
    如何处理请求返回的二进制数据流转化成xlsx文件?
    iview 表单验证不通过问题?
    如何发布一个npm包?
    async 与 await
    数据库事务的四个基本特征以及事务的隔离级别
    遍历Map的四种方式
    HashMap详解
    HashMap和Hashtable的区别
    java中的堆、栈和常量池简介
    Spring IOC(转载)
  • 原文地址:https://www.cnblogs.com/blueteasama/p/5669650.html
Copyright © 2020-2023  润新知