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

    少量加入了一些个人注释

  • 相关阅读:
    pycharm2016.2.3注册码到期, 激活, 破解版
    CSS图片垂直居中方法
    C# 与 SQLite的操作
    C#操作Dataset数据集与SQLite数据库
    混合模式程序集是针对“v2.0.50727”版的运行时生成的,在没有配置其他信息的情况下,无法
    从谎言看女性营销心理【转】
    Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.【转】
    新房收房时哪些注意事项--装修史上最细规则【转】
    人际沟通最忌讳一脸死相【转】
    比特币
  • 原文地址:https://www.cnblogs.com/blueteasama/p/5669650.html
Copyright © 2011-2022 走看看