29495人加入学习
(81人评价)
C#编程-第一季-编程基础-宇宙最简单2021最新版

制作完成于2021年10月10日,使用Visual Studio 2019

价格 免费
using System;

namespace _006_变量研究
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 5, b = 10;

            //a = b;
            //b = a;

            //int temp = a;
            //a = b;
            //b = temp;

            a = a + b;
            b = a - b;
            a = a - b;

            Console.WriteLine(a);
            Console.WriteLine(b);
        }
    }
}

减法交换变量:

            a = a - b;//5-10=-5
            b = b + a;//10+(-5)=5
            a = b - a;//5-(-5)=10

 

[展开全文]
using System;

namespace _005_练习题
{
    class Program
    {
        static void Main(string[] args)
        {
            //int a = Convert.ToInt32(Console.ReadLine());
            //int b = Convert.ToInt32(Console.ReadLine());
            //int c = a + b;
            //Console.WriteLine(c);

            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int c = (a + b) / 2;
            Console.WriteLine(c);
        }
    }
}

 

[展开全文]
using System;

namespace _004_字符类型
{
    class Program
    {
        static void Main(string[] args)
        {
            //怎么读取数据 输入数据
            //string str = Console.ReadLine(); // "12" 12
            //Console.WriteLine(str + "-");

            //1、类型一致  2、右边的值所需要的容器大小 小于等于左边的容器
            //int a = Console.ReadLine();

            string str = Console.ReadLine();// "12" 12
            int strInt = Convert.ToInt32(str);// "12" 12   "df"

            int a = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine(strInt + "-" + a);
        }
    }
}

 

[展开全文]
using System;

namespace _004_字符类型
{
    class Program
    {
        static void Main(string[] args)
        {
            //char a = 'c';
            //int b = a;
            //Console.WriteLine(a);
            //Console.WriteLine(b);//99

            //97 a
            //int a = 97;
            //char b = (char)a;//强制类型转换 强塞
            //Console.WriteLine(a);
            //Console.WriteLine(b);

            //char a = '1';
            //int b = a;
            //Console.WriteLine(a);
            //Console.WriteLine(b);

            //char a = '\n';
            //char b = '\\';
            //char c = '\"';
            //char d = '\t';
            //char e = '\'';

            //Console.WriteLine("c:\\a\\b\\c");
            //Console.WriteLine(@"c:\a\b\c");
            //Console.WriteLine(@"c:\\a\\b\\c");

            //string str = @"www.sikiedu.com\nsiki";
            //            string str = @"www.sikiedu.com ""
            //abc
            //123
            //456789";
            //            Console.WriteLine(str);

            string str = "123" + "456";
            string str2 = str + "www";
            Console.WriteLine("www" + 123);
        }
    }
}

 

[展开全文]
using System;

namespace _004_字符类型
{
    class Program
    {
        static void Main(string[] args)
        {
            //char a = 'c';
            //int b = a;
            //Console.WriteLine(a);
            //Console.WriteLine(b);//99

            //97 a
            int a = 97;
            char b = (char)a;//强制类型转换 强塞
            Console.WriteLine(a);
            Console.WriteLine(b);
        }
    }
}

 

[展开全文]
using System;

namespace _003_变量
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 3, b = 8;
            Console.WriteLine(a + b);//11
            Console.WriteLine("a + b");//a + b
            Console.WriteLine(a + "+" + b);//3+8
            Console.WriteLine("a+b" + a + b);//a+b38
            Console.WriteLine("a+b" + (a + b));//a+b11
        }
    }
}

 

[展开全文]
using System;

namespace _003_变量
{
    class Program
    {
        static void Main(string[] args)
        {
            int total;

            //赋值
            total = 4;

            //int a;
            //a = 1;
            //int b = 1;

            int a = 1;
            a = 3 + 7 - 2;
            int b = 3;
            b = b + 1;

            Console.WriteLine(a);
            Console.WriteLine(b);

            int c;
            c = 10;//初始化
            c = 11;
            Console.WriteLine(c);

            //female male
            char sex = 'f';
            sex = 'm';
        }
    }
}

 

[展开全文]
using System;

namespace _003_变量
{
    class Program
    {
        static void Main(string[] args)
        {
            //创建变量
            //创建了一个数据的容器,容器的名字叫做age,容器的类型是int
            //声明了一个变量,变量的名字是age
            int age; //int变量类型 age变量名
            //往容器里面放东西 赋值
            age = 10;

            double age2;

            char age3;

            double height;

            char sex;

            int count;

            double ave;

            int total;
            
            double temperature;
        }
    }
}

 

[展开全文]

C#编译

代码 -> 程序集(exe dll)

程序集在运行的时候会编译成机器指令(JIT 及时编译)

[展开全文]
using System;

namespace _002_练习
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("*");
            Console.WriteLine("**");
            Console.WriteLine("***");
            Console.WriteLine("****");
            Console.WriteLine("*");
            Console.WriteLine("*");
            Console.WriteLine("*");
        }
    }
}

2

using System;

namespace _002_练习
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("   *");
            Console.WriteLine("  ***");
            Console.WriteLine(" *****");
            Console.WriteLine("*******");
            Console.WriteLine("   *");
            Console.WriteLine("   *");
            Console.WriteLine("   *");
        }
    }
}

3

using System;

namespace _002_练习
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("\\\"");
        }
    }
}

4

using System;

namespace _002_练习
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("SiKi说:\"what is\\n\"");
        }
    }
}

 

[展开全文]
using System; //注释:引入命名空间

namespace _001_开始
{
    //这个是Program类
    class Program
    {
        //这个是Main方法
        static void Main(string[] args)
        {
            //ctrl + k ctrl + c
            //Console.WriteLine("Hello World!1");//这个是输出语句
            /*
             sdf
            sdf   sdf
            sdf
             */
            //Console.WriteLine("Hello World!2");

            //Console.WriteLine("Hello World 你好,世界3");

            //Console.Write("Hello,World!");
            //Console.Write("www.sikiedu.com");
            Console.WriteLine("Hello ");
            Console.WriteLine("World!");

            Console.WriteLine("He\tllo \nWorld!\\");
        }
    }
}

(1)注释:

单行注释 //

多行注释 /* zhushi */

注释快捷键:ctrl+k ctrl+c

取消注释快捷键:ctrl+k ctrl+u

(2)语句结束加上 ;

(3)代码块 { }

(4)顺序执行

(5)Write 输出后不换行,WriteLine 输出后换行。

 

[展开全文]
using System; //注释:引入命名空间

namespace _001_开始
{
    //这个是Program类
    class Program
    {
        //这个是Main方法
        static void Main(string[] args)
        {
            //ctrl + k ctrl + c 注释快捷键
            Console.WriteLine("Hello World!1"); //这个是输出语句

            /* 多行注释
             sdf
            sdf   sdf
            sdf
             */

            Console.WriteLine("Hello World!2");

            Console.WriteLine("Hello World 你好,世界3");
        }
    }
}

 

[展开全文]
using System; //注释:引入命名空间

namespace _001_开始
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.WriteLine("Hello World!");
        }
    }
}

 

[展开全文]

Consolas 和 JetBrains Mono 字体,适合 程序员 写代码用。

[展开全文]

1.38  11

2.a+b

3.3+8

4.a+b38

5.a+b11  

[展开全文]

1、注释快捷键:CTRL+K  CTRL+C

取消注释快捷键:CTRL+K  CTRL+U

2、运行快捷键:F5

[展开全文]

授课教师

加我的QQ问问题:804632564

课程特色

下载资料(1)
视频(118)
图文(2)