流浪のwolf

卷帝

导航

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 73 下一页

2024年2月24日

C# 新语法 switch 的简单写法

摘要: // C# 中的新语法 switch 的简写 string str = "123"; string res = str switch { "1" => "1", "2" => "2", "3" => "3", _ => "default", }; 阅读全文

posted @ 2024-02-24 10:55 流浪のwolf 阅读(296) 评论(0) 推荐(0) 编辑

C# 的运算符和作用域

摘要: // C# 运算符 // 表达式 表达式有操作数(operand)和运算符(operator)构成; // 常见的运算符 + - * / 和 new // x ?? y 如果x为null, 则计算机过为y否则计算结果为x; // 匿名函数 (lamba表达式) // 前置的 ++ 直接执行 后置的 阅读全文

posted @ 2024-02-24 10:49 流浪のwolf 阅读(8) 评论(0) 推荐(0) 编辑

C# 的空类型

摘要: // 空类型 null int iii; // 默认 0 bool bbb; // 默认 false bool? b; // 空值 null int? i; // 空值 null string str; // 默认 null 空值 str = null; string str1 = ""; // n 阅读全文

posted @ 2024-02-24 10:32 流浪のwolf 阅读(7) 评论(0) 推荐(0) 编辑

C# 的布尔类型和字符串类型(模板字符串)

摘要: // 布尔类型 boll bool b = false; b = 1 == 1; // true bool b1 = 1 > 23; // false // 值类型 : 在代码中初始化类型的时候没有赋值 但是系统会自动赋值的叫值类型 // byte short int(default 0) long 阅读全文

posted @ 2024-02-24 10:04 流浪のwolf 阅读(78) 评论(0) 推荐(0) 编辑

C# 的浮点类型 float double 和十进制类型 decimal

摘要: // 浮点型数据 float double(双精度) // float f = 1.1; // ps:写小数的时候只要后面没有加上 f/F 默认是double类型 // 正确的定义 double d = 1.1; float f = 1.1F; float f1 = 1f; // f = d; // 阅读全文

posted @ 2024-02-24 09:47 流浪のwolf 阅读(118) 评论(0) 推荐(0) 编辑

C# 中的四种整形数据

摘要: // C# 中有四种整数类型 byte short int long byte bMax = byte.MaxValue; /// 255 最大值 byte bMin = byte.MinValue; /// 0 最小值 short sMax = short.MaxValue; // 32767 s 阅读全文

posted @ 2024-02-24 09:34 流浪のwolf 阅读(25) 评论(0) 推荐(0) 编辑

2024年2月22日

C++ 第四节课 C和C++指针的区别 C的宏函数和C++内联函数的优缺点

摘要: #include <iostream> // 定义一个宏函数 #define ADD(x,y) x+y; // 宏函数具有速度快等特点 但是写代码有些业务比较繁琐,所以C++中使用了内联函数优化 // 在定义函数前面添加一个inline把这个函数变成内联函数 inline int max(int x 阅读全文

posted @ 2024-02-22 23:11 流浪のwolf 阅读(4) 评论(0) 推荐(0) 编辑

C++ 第三节课 指针的使用

摘要: #include <iostream> using namespace std; void show(){ cout << "全局函数" << endl; } struct Stu { int a; void write_code(){ cout << "成员函数" << endl; } }; in 阅读全文

posted @ 2024-02-22 21:38 流浪のwolf 阅读(4) 评论(0) 推荐(0) 编辑

2024年2月21日

C++ 第二节课 结构体, 字符串 和 C语言的区分

摘要: 1 #include <iostream> 2 3 using namespace std; 4 5 6 // 结构体 7 struct Stu{ 8 string name; 9 int age; 10 11 // 结构体重的函数叫做成员函数 在 C 中是不能直接写函数的 只能使用函数指针,通过指 阅读全文

posted @ 2024-02-21 21:39 流浪のwolf 阅读(2) 评论(0) 推荐(0) 编辑

C++ 第一节课 名字空间 ,输入输出函数,和 C 语言的区别

摘要: #include <iostream> // #include 头文件,C++标准库的头文件都不带 .h (.h 是C库头文件添加的) #include <cstdio> #include <cstring> using namespace std; // namespace 命名空间 为了防止变量 阅读全文

posted @ 2024-02-21 20:40 流浪のwolf 阅读(6) 评论(0) 推荐(0) 编辑

上一页 1 ··· 6 7 8 9 10 11 12 13 14 ··· 73 下一页