zoukankan      html  css  js  c++  java
  • 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();
    
    
    
            }
        }
    }

    少量加入了一些个人注释

  • 相关阅读:
    Linux Kernel 2:用户空间的初始化
    Linux Kernel系列一:开篇和Kernel启动概要
    谢宝友:会说话的Linux内核
    如何给USB移动硬盘格式化分区
    AVR单片机最小系统 基本硬件线路与分析
    Altium Designer 基本封装
    AVR单片机命名规则
    LynxFly科研小四轴横空出世,开源,F4,WIFI --(转)
    四轴自适应控制算法的一些尝试开源我的山猫飞控和梯度在线辨识自适应等算法—(转)
    我的四轴专用PID参数整定方法及原理---超长文慎入(转)
  • 原文地址:https://www.cnblogs.com/blueteasama/p/5669650.html
Copyright © 2011-2022 走看看