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

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

价格 免费

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

if( a <= 16){

Console.WriteLine("可以进入游乐园");

}else{

Console.WriteLine("不可以进入游乐园");

}

if(){}

if(){}else{}

[展开全文]

编程题

1 A C D

2 B

3 A C D

4            int a = Convert.ToInt32(Console.ReadLine());
            int temp = a;
            int min = a % 10;
            int max = temp / 100;
            int mind = temp / 10 % 10;
            Console.WriteLine("{0} {1} {2}",min,mind,max);

5            int a = Convert.ToInt32(Console.ReadLine());
            int shi = a / 10 % 10;
            int qian = a / 1000 % 10;
            int dianBao = qian * 10 + shi;
            Console.WriteLine((char)dianBao);

6

1️⃣ b = 7

2️⃣b = 8

7

            Console.WriteLine("输入数学分数");
            int a = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("输入英语分数");
            int b = Convert.ToInt32(Console.ReadLine());
            bool c = a >= 90 && b >= 90;
            Console.WriteLine("获得奖励是否成功:{0}",c);

   

[展开全文]

            int a = Convert.ToInt32(Console.ReadLine());
            bool b = a <= 17;
            bool c = a >= 61;
            bool d = b && c;
            Console.WriteLine("结果是{0}   false为青年,true不是青年",d);

 

 

 

bool isYoung = a>=18 && a<= 60;

int res = 3 + 2 * 4;

console.writeline(res);

运算符有优先级

[展开全文]

A = true  B =false

(A&&B)= FALSE

(A||B)= TRUE

!(A&&B)=TRUE

[展开全文]

关系运算符和布尔运算符

==

<

<=

>

>=

不等于的输入方式

!=

 

练习题

两边对比可以是变量

false 

true

true

true

true

false

[展开全文]

int a = 5

int b = a++;

//先赋值 后运算

Console.WriteLine(b); //5

int b = ++a;

Console.WriteLine(b);//7

//先运算 后赋值

[展开全文]

int a =89

int b = a / 10

int c = a % 10

console.writeLine("个位数{1}十位数{0}",b,c);

 

 

[展开全文]

数学运算符,算数运算符

-

*

/

取模运算%

5%2 = 1

6%2 = 0

7%2 = 1

8%2 = 0

9%2 = 1

10%2= 0

11%2 = 1

[展开全文]

Console.WriteLine("Hello World!");

//加注释

单行注释

多行注释/*       */

 

[展开全文]
            int x = rd.Next(1, 101);//生成一个伪随机数
            Console.WriteLine("猜数字");
            while (true)//死循环  当猜中了跳出循环
            {
                int a = Convert.ToInt32(Console.ReadLine());
                if (a < x)
                {
                    Console.WriteLine("猜小了");
                }else if (a > x)
                {
                    Console.WriteLine("猜大了");
                }else
                {
                    Console.WriteLine("猜中了");
                    break;
                }
            }
            Console.ReadKey();

 

[展开全文]

            //输⼊两个整数num1和num2,输出这两个正整数num1和num2的最⼤公约数。
            int a = Convert.ToInt32(Console.ReadLine());
            int b = Convert.ToInt32(Console.ReadLine());
            int min = a;//定义最小值为min
            if (b < a)//保持min是最小的
            {
                min = b;
            }
            for (int i = min ; i > 0; i--)//从大到小遍历输入的较小值到1
            {
                if (a % i == 0 && b % i == 0)//如果同时是a,b的因数就是最大公约数
                {
                    Console.WriteLine(i);
                    break;//只需要输出一个
                }
            }
            
            Console.ReadKey();

 

[展开全文]

int a = 5 b =10;

int temp = a ;

a = b;

b= temp ;

其他解法下面解法内存占用多

a = a +b;

b = a- b;

a = a- b;

[展开全文]

题1

            int a = Convert.ToInt32(Console.ReadLine());
            
            int b = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine(a+b);

题2

            int a = Convert.ToInt32(Console.ReadLine());
            
            int b = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine(a/b);

题3 

除了4 都正确

 

题4

 A

题5

A

[展开全文]

string str = "132"+"456";

string str2 = str +"www";

console.writeline("www"+123);

 

string str = console .readline();

console.writeline(str +"-");

1 类型一致

2 右边的值所需要的容器大小,小于等于左边的容器

            string a = Console.ReadLine();
            int a1 = Convert.ToInt32(a);
            string b = Console.ReadLine();
            int b1 = Convert.ToInt32(b);
            Console.WriteLine(a1+b1);

 

int a = console.readl

[展开全文]

\n 为特殊字符

@ 为直接转译字符

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

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

两段代码得输出结果是一致的

字符串不能多行必须连贯,只能在同一行

加入了@后就可以了

[展开全文]

字符存储为数字

按十进制 字符c底层存储是99   a=97

ASCII字符代码表(十进制)

int a = 97;

char b = a;

赋值两边要一致,

赋值小容器的可以赋值给大容器

大容器无法赋值给小容器

char b = (char)a;//强制类型转换 强塞

 

[展开全文]

23 = a; 错误 变量不能数字命名

a = b+c;对

x+y=z;错

a=a+1;对

 

int a =1;

a= 3+7-2;

int b = 3;

b = b+ 1;// b = 4

 

c = 4

c = 7

c = 16

a = 16

a = 48

 

11

a+b

3+8

a+b38

a+b11

[展开全文]

int age;

int jishuqi;

double pingjunshu;

double shengao;

double zonghe;

double char;

 

 

int count;

double ave;

double height;

int total;

double temperature;

 

total = 4;

 

[展开全文]

授课教师

SiKi学院老师

课程特色

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