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

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

价格 免费

代码结束编写后一定要输入“;”做结束

注释必须在代码最后一个字符之后编写

“/*.........(中间为注释内容)*/”此类代码为多行代码,与“//”单行代码有所区别

ctrl+k后不松开ctrl,再按c可快速注释一行代码,若要注释多行只需要框选多行代码的内容即可;要取消则ctrl+k后不松开ctrl,再按U即可取消注释

代码执行顺序永远都是从上往下,不会改变

[展开全文]

优化算法,已经排过序的数不需要再做比较

[展开全文]

dowhile在不满足条件表达式 会先执行

[展开全文]

0、.netframework形式的控制台在第一个“}”上一行写入“Console.ReadKey();”代码后,启动后的窗口就不会自动关闭

1、代码后输入“//+内容”即为该代码引入注释

2、创建命名空间输入代码“namespace+命名空间名字”,后输入“{}”,实际内容于“{}”之间输入

(注释:命名空间就相当于是windows里面的文件夹。文件夹对文件做管理,命名空间对类做管理)

[展开全文]

.net framework形式的控制台需要在第一个“}”上一行加入“Console.ReadKey();”的代码后,启动后的窗口就不会自动关闭

[展开全文]

类型     描述                    范围                      默认值
bool    布尔值         True 或 False                  False
byte    8 位无符号整数    0 到 255                  0
char    16 位 Unicode 字符    U +0000 到 U +ffff                                                                          '\0'
decimal    128 位精确的十进制值,28-29 有效位数      (-7.9 x 1028 到 7.9 x 1028) / 100 到 28                                                                            0.0M
double    64 位双精度浮点型    (+/-)5.0 x 10-324 到 (+/-)1.7 x 10308                                      0.0D
float    32 位单精度浮点型    -3.4 x 1038 到 + 3.4 x 1038                                                              0.0F
int    32 位有符号整数类型    -2,147,483,648 到 2,147,483,647                                                 0
long    64 位有符号整数类型    -9,223,372,036,854,775,808 到 9,223,372,036,854,775,807                             0L
sbyte    8 位有符号整数类型    -128 到 127       0
short    16 位有符号整数类型    -32,768 到 32,767                                                                            0
uint    32 位无符号整数类型    0 到 4,294,967,295                                                                             0
ulong    64 位无符号整数类型    0 到 18,446,744,073,709,551,615                              0
ushort    16 位无符号整数类型    0 到 65,535    0

[展开全文]

函数可以直接放在结构体里面,

因为可以直接访问当前结构体内的值,所以就不需要形参;

[展开全文]

using。。

命名空间。。

        类

              方法

                     代码

[展开全文]

convert toint32()

console readlne()

输入

[展开全文]
 public class Vector
    {

        static void Main(string[] args)
        {

            Week day=Week.Mon;
            Console.WriteLine(day);
            //强转后可以查询enum中枚举类型的值
            //如Week.Mon为1
            int number=(int)day;
        }
        
        enum Week
        {
        //  0  ,1  ,2  ,3  ,4  ,5  ,6
            Sun,Mon,Tue,Wed,Thu,Fri,Sat
        }
        enum Week2
          {
        //  0  ,1  ,2  ,10,11 ,100    ,101,102
            Sun,Mon,Tue=10,Wed,Thu=100,Fri,Sat
        }
    }
```

 

[展开全文]


            char c;
            int sum = 0;
            do
            {
                c = (char)Console.Read();
                if (c >= '0' & c <= '9')
                {
                    int num = c - '0';
                    sum += num;
                }
                else if(c=='*')
                    {
                    sum += 500;
                }

            } while (c!='#');

            Console.WriteLine(sum);

[展开全文]

 int num = Convert.ToInt32(Console.ReadLine());
            int i = 0;
            int x=0;
            int sum = 1;
            int y = num;
            int z = num;
            while (num != 0)
            {
               
                 i = num % 10;
              
                sum *= 10;
                num /= 10;
            }
            while (y != 0)
            {
                sum /= 10;
                i = y % 10;
                x = i * sum + x;
                
               y /= 10;
            }
            if (x == z)
                Console.WriteLine("yes");
            else
                Console.WriteLine("no");
 

[展开全文]

 int num = Convert.ToInt32(Console.ReadLine());
      

          
               while( num % 10==0)
                { num /= 10; 
                }
              
               
               while(num!=0)
                {
                    int i = num % 10;
                Console.Write(i);
                    num /= 10;
                }

[展开全文]


            double qiu = Convert.ToDouble(Console.ReadLine());
            double sum = 0.0;
            double a = qiu;
            for (int i = 0; i <10; i++)
            {
                sum = qiu * 2.0 + sum;
                qiu =qiu/ 2.0;
                

            }
            Console.WriteLine(qiu);
            Console.WriteLine((sum-a));

[展开全文]

ctrl+k   crtl+c   出现双斜杠

ctrl+k   ctrl+u   取消双斜杠

[展开全文]

//单行注释

 

/*多行注释

多行

多行

*/ 

 

main方法

 

注释 ctrl+k+ctrl+c

取消注释  ctrl+k ctrl+u

[展开全文]

int n = Convert.ToInt32(Console.ReadLine());
            int i = 0;
            while (n != 1) 
            {
                if (n % 2 == 1)
                    n = 3 * n + 1;
                else
                    n = n / 2;

                i++;
               
            }
            Console.WriteLine(i);

[展开全文]

授课教师

问问题加入A计划,有专门负责答疑的老师哦!!!

课程特色

下载资料(1)
视频(117)
图文(3)