- 博客(25)
- 收藏
- 关注
原创 C语言数组与指针
//1.数组名 //数组名的值是一个指针常量,也是第一个元素的地址 int arr[10] = {0,10,20,30,40,50,60,70,80,90}; int *p; //&arr[0]和p的值(地址值)相等 p = &arr[0]; qDebug() << p; p = arr; qDebug() << p; //2.下标引用 qDebug() << *...
2022-03-05 14:07:30
375
原创 c++智能指针
//-------------------------------------------------------------------- //不对shared_ptr初始化时,指向的地址为0 shared_ptr<int> ptr0; cout << ptr0.get() << endl; //智能指针ptr1初始化了一个有效地址,引用计数为1 shared_ptr<int> ptr1(new int(520)).
2021-12-30 09:42:12
448
原创 字符数组、sizeof()、strlen()
sizeof():运算符,在编译的时候就计算好了,计算的是分配给数组所占的内存大小strlen():函数,在运行时才能计算,计算的是不包含空字符的字符串长度 char arr0[] = "hello \0########"; cout << sizeof(arr0) << endl; //16,推导出arr0数组占16个字节,包含结尾隐式的"\0" cout << strlen(arr0) << endl; //6,st.
2021-12-30 09:37:06
462
转载 MVVM模式的3种command总结--DelegateCommand
查了不少资料,大概理清楚的就是有3种。当然类名可以自己取了,不过为了便于记忆和区分,还是和看到的文章里面用一样的类名。1.DelegateCommand2.RelayCommand3.AttachbehaviorCommand因为MVVM模式适合于WPF和SL,所以这3种模式中也有一些小差异,比如RelayCommand下面的CommandManager方法就是WPF下面的,SL下面无法使用,不过我认为这3种方法中的基本思路都如出一辙,都是出自那位外国牛人的文章里面。主要的区别在于和VIEW
2021-09-22 08:52:35
2289
翻译 C#标准事件的用法
来源:《C#图解教程》using System;namespace ConsoleApp2{ class Program { static void Main(string[] args) { Incrementer incrementer = new Incrementer(); Dozens dozensCount = new Dozens(incrementer); in
2021-09-08 19:22:35
213
翻译 C#委托基本用法
1.简单委托和自定义委托Action:没有返回值类型的委托Func:有返回值类型的委托using System;namespace ConsoleApp1{ public delegate double Calc(double x, double y); class Program { static void Main(string[] args) { //简单委托:Action(没有返回值类型的委托)和Fu
2021-09-06 19:31:12
793
原创 获取本地物理MAC地址(方法二)
#include <string>#include <WinSock2.h>#include <Iphlpapi.h>#include <iostream>using namespace std;#pragma comment(lib,"Iphlpapi.lib")BOOL IsVirtualNetCard(const PIP_ADAPTER_INFO pIpAdapterInfo){ //去除有特征名的虚拟网卡 //if (.
2021-08-17 20:16:19
190
原创 获取本地物理MAC地址(方法一)
#include <cstdio>#include <cstdlib>#include <iostream>#include <strsafe.h>#include <WinSock2.h>#include <Iphlpapi.h>#include <cstring>#pragma comment(lib,"Iphlpapi.lib")using namespace std;BOOL GetRegInf.
2021-08-17 19:32:50
388
原创 C++ 子类继承父类构造方法和委托父类构造方法
关键词:继承;继承构造;委托构造#include <iostream>using namespace std;class Base{public: Base(int a, int b, int c) { m_a = a; m_b = b; m_c = c; cout << "父类的构造函数m_a :" << m_a << endl; }public:
2021-08-16 09:41:18
1563
原创 获取MAC地址的三种方法
方法一:使用iphlpapi.h获得windows下一些基本的网络连接信息#include <Iphlpapi.h>#include <Assert.h>#pragma comment(lib, "iphlpapi.lib")using namespace std;int PRINT_DEBUG = true;// Prints the MAC address stored in a 6 byte array to stdoutstatic void Pri..
2021-08-13 15:47:36
4518
1
原创 std::bind绑定类的成员函数
类的成员函数必须通过类的对象或者指针调用,因此在bind时,bind的第一个参数的位置来指定一个类的实列、指针或引用。class Test{public: int funs(int val) { std::cout << "hello world " << val << std::endl; return val; }};class message{public: std::functio
2021-08-03 13:52:26
5266
原创 std::function 和 std::bind 的简单例子
#include <QCoreApplication>#include <functional>#include <iostream>using namespace std;void print(){ std::cout << "here is print" <<'\n';}void print_num(int i){ std::cout << i << '\n';}void pr.
2021-06-25 16:33:01
142
原创 QT中json的生成和解析
1. json的生成 // 构建 Json 数组 - Version QJsonArray versionArray; versionArray.append(4.8); versionArray.append(5.2); versionArray.append(5.7); // 构建 Json 对象 - Page QJsonObject pageObject; pageObject.insert("Home", "https://www.qt
2021-06-15 14:55:16
349
原创 C语言单链表实现
参考:https://www.bilibili.com/video/BV1Rb411F738?from=search&seid=2404768265956671653
2020-09-17 10:15:32
123
原创 排序算法的C语言实现C代码
总结并编写了部分常用的排序算法,包括前向、后向冒泡排序、简单选择排序、直接插入排序、希尔排序、堆排序、并归排序和快速排序。具体的原理请参考《大话数据结构》。
2020-08-31 15:05:45
930
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人