zoukankan      html  css  js  c++  java
  • c#入门

    using System;
    
    namespace EightQueen
    {
        class Program
        {
            static void Main(string[] args)
            {
                /*
                1、hello world
                Console.WriteLine("Hello World!");
                Console.Read();
                
    
                2、数据类型
                int a = 1;
                float b = 0.1f;
                bool c = true;
                char d = 'd';
                string e = "string";
    
                3、常量
                const string f = "string";
    
                4、运算符
                 =,+,-,*,/,%,++,--,+=,-=,*=,/=,%=
    
                5、类型装换
                低精度=》高精度(float=int):直接转
                高精度=》低精度(int=(int)float):需强转
                Convert.ToInt32("66");//字符串=》int
                int.Parse("66");//字符串=》int
                Convert.ToSingle("66.6");//字符串=》float
                float.Parse("66.6");//字符串=》float
                66.ToString();//其它类型=》string
    
                6、分支语句
                关系运算符:>,>=,<,<=,==,!=
                逻辑运算符:&&,||,!
                if语句:
                    if(布尔值){
                        执行语句
                    }else if(布尔值){
                        执行语句
                    }else{
                        执行语句
                    }
                switch case语句:
                    switch(变量){
                        case 值: 
                            执行语句
                            break;
                        default: 
                            执行语句
                            break;
                    }
    
                7、循环语句
                while循环:
                    while(布尔值){
                        执行语句
                    }
                for循环:
                    for(int i=0;i<10;i++){
                        执行语句
                    }
                do while循环:
                    do{
                        执行语句
                    }while(布尔值);
    
                8、数组
                一维数组:
                    int[] arr1=new int[3];
                    int[] arr2 = { 1, 2, 3 };
                二维数组:
                    int[,] arr3=new int[3,2];//3行2列数组
                    arr3[0, 0]=0;//第1行1列
                    arr3[2, 1]=0;//第3行2列
                    int[,] arr4={{0,1},{2,3},{4,5}};
                */
    
                string str = Console.ReadLine();
            }
        }
    }
    
  • 相关阅读:
    SPA项目开发之登录
    使用vue-cli搭建SPA项目
    ElementUI入门和NodeJS环境搭建
    struts文件上传
    Struts增删改查
    struts
    Maven
    easyui三
    EasyUi权限
    自定义MVC三
  • 原文地址:https://www.cnblogs.com/linding/p/15234618.html
Copyright © 2011-2022 走看看