- 博客(41)
- 收藏
- 关注
原创 openharmony sdk描述
OPENHARMONY SOFTWARE DEVELOPER KITS LICENSE AGREEMENTThis OpenHarmony Software Developer Kits License Agreement (this "Agreement") is entered into effect by and between You and OpenAtom Foundation (the "OpenAtom"), whose registered office is situated at Ro
2024-11-21 15:34:44
875
原创 c++之default/delete
在C++中,声明自定义的类型之后,编译器会默认生成一些成员函数,这些函数被称为默认函数。其中包括(1)(默认)构造函数(2)拷贝(复制)构造函数(3)拷贝(复制)赋值运算符(4)移动构造函数(5)移动赋值运算符(6)析构函数另外,编译器还会默认生成一些操作符函数,包括(7)operator ,(8)operator &(9)operator &&(10)operator *(11)operator ->(12)operat..
2022-02-05 13:54:45
1829
原创 c基础题目1
下列函数指针初始化合法的有哪几个?//void (*f)();void test1(void);void test2(int i);int test3(void);void (*f1)() = test1; // OKvoid (*f2)() = &test1; // OKvoid (*f3)() = test2; // ERRORvoid (*f4)() = *test1; // OKvoid (*f5)() = test3; // ERROR...
2022-02-05 13:50:50
425
原创 c++ new操作符
C++当中3种new的用法 | Fantacity近在看侯捷侯老师的著作《STL源码剖析》,书中第二张开始讲到了stl中的allocator的一个简易实现,发现原来cpp中的new其实除了我们平常用的最多的new表达式(new operator)之外,还有剩下两种用法。1. new operator/delete operatornew operator,也叫new表达式,是我们在cpp中最常见的new的用法,比如:string *pStr = new string("abd")..
2021-11-16 17:47:09
5196
原创 c++基础3 constexpr
下列函数指针初始化合法的有哪几个?//void (*f)();void test1(void);void test2(int i);int test3(void);void (*f1)() = test1; // OKvoid (*f2)() = &test1; // OKvoid (*f3)() = test2; // ERRORvoid (*f4)() = *test1; // OKvoid (*f5)() = test3; // ERROR...
2021-08-21 16:24:00
119
原创 C语言基础之格式化占位符
在 printf 系列函数中,下列哪个格式化占位符有可能导致内存任意写风险 [A]A. %nB. %dC. %pD. %s使用printf修改变量的值 —— VS2008中使用%n输出遇到的问题及解决方法#include <stdio.h>int main(void){ int e; int i = 0; e = _set_printf_count_output( 1 ); printf( "%%n support was ...
2021-07-14 16:05:18
3730
原创 笔试题学习
解决行间距过大,换行时按shift+回车,果然行,呵呵。改成下面这样了:题目//执行下面语句:a[4];for(int i=0;i<4;++i){ if(i&1){ a[i]=1; }}//则a数组中的值为()0 1 0 1判断奇偶,奇数为1& 按位取与| 按位取或~ 按位取非^ 按位异或https://www.runoob.com/cprogramming/c-operators.html...
2021-04-17 18:10:41
599
原创 网址备份
[转] linux下shell中使用上下键翻出历史命名时出现^[[A^[[A^[[A^[[B^[[B的问题解决,Linux使用退格键时出现^H解决方法https://my.oschina.net/u/4287113/blog/3984036https://www.zmrbk.com/post-2030.htmlhttps://blog.youkuaiyun.com/suifengshiyu/article/details/40952771...
2021-03-22 19:08:22
106
原创 DFS BFS
根据图的结构的不同,算法不同。图的结构有,链表数组:std::vector<std::list<int>> graph;二维数组。算法由队列辅助法,递归法。对于链表数组C++ 实现图的 DFS 和 BFShttps://murphypei.github.io/blog/2019/04/cpp-bfs-dfs对于二维数组https://blog.youkuaiyun.com/weixin_45830777/article/detai...
2021-03-09 11:15:48
90
原创 算法
六大算法递归https://blog.youkuaiyun.com/zw6161080123/article/details/79985021回溯https://blog.youkuaiyun.com/zw6161080123/article/details/79985345动态规划https://blog.youkuaiyun.com/zw6161080123/article/details/80639932https://search.bilibili.com/all?keyword=%E5%8A%A8%E6%
2021-02-18 15:37:57
97
原创 C++基础1
全局对象的构造函数会在main函数之前执行。https://blog.youkuaiyun.com/x_iya/article/details/52685139https://www.cnblogs.com/lgh1992314/p/6616361.html
2021-02-18 11:30:23
292
1
原创 stl之map vector
C++中map提供的是一种键值对容器,里面的数据都是成对出现的,如下图:每一对中的第一个值称之为关键字(key),每个关键字只能在map中出现一次;第二个称之为该关键字的对应值。——————————————————————————————————————————————一. 声明//头文件#includemap<int, string> ID_Name;// 使用{}赋值是从c++11开始的,因此编译器版本过低时会报错,如visual studio 2012map<int,
2021-02-07 20:44:30
198
原创 编程题目学习
编程题目题目:和可被 K 整除的子数组 链接:https://leetcode-cn.com/problems/subarray-sums-divisible-by-k时间 : 2021-02-02 19:00-20:00 (UTC+08:00)Beijing
2021-02-04 14:40:22
188
原创 C语言基础1
小端环境输出结果为value = 0x00004043typedefstructTestData_{ unsignedintdata1:2; unsignedintdata2:12; unsignedintdata3:2}TestData;intmain(void){ TestDatadata; memset(&data,0,sizeof(data)); data.data1=0x...
2021-02-03 17:03:48
1026
原创 STL之string
下面这个声明会(D)const std::string str1;A:、导致编译错误B、强制程序员在str1被使用前为其赋值C、由具体实现决定其行为D、将str1的内容置为空串。
2021-02-03 15:12:41
130
原创 C基础之static extern
//a.h// int g_count; // first// static int g_count; // second extern int g_count; // thirdvoid addCount(int);// a.cpp#include "a.h"int g_count; // third// if no this, 无法解析的外部符号int g_count// b.cpp#include "a.h"void IncrCount(void){ g_coun.
2021-02-03 14:51:12
132
原创 C++之emplace
最近在写一段代码的时候,突然很好奇C++11中对push_back有没有什么改进以增加效率,上网搜了一些资料,发现果然新增了emplace_back方法,比push_back的效率要高很多。首先,写了一个类用于计时,//time_interval.h#pragma once#include <iostream>#include <memory>#include <string>#ifdef GCC#include <sys/time....
2021-02-03 11:20:37
1030
原创 C++之namespace
错误的是namespace A{ int i = 1;}namespace B{ void a(void); void b(void); void c(void); void d(void);}void B::a(void){ using namespace A; i++;}void B::b(void){ using A::i; i++;}void B::c(void){ A::i...
2021-02-02 22:12:09
995
原创 CLION用法
CTRL+ALT+I自 动缩进 (我主要是找这个功能,其他的没有试过)查询快捷键CTRL+N查找类CTRL+SHIFT+N查找文件CTRL+SHIFT+ALT+N查 找类中的方法或变量CIRL+B找变量的来源CTRL+ALT+B找所有的子类CTRL+SHIFT+B找变量的 类CTRL+G定位行CTRL+F在当前窗口查找文本CTRL+SHIFT+F在指定窗口查找文本CTRL+R在 当前窗口替换文本CTRL+SHIFT+R...
2021-01-30 20:16:44
1798
原创 C语言基础之#define #include
/*#define h(x) g(x)#define g(x) #x#define f(x, y) x##y#define con(x, y) x##yvoid haha(){ cout << "haha" <<endl;}int main(){ int a = 0; int b = 2; int* c = NULL; //a == 0 ? b = 1 + 2 + 3 : NULL; a == ...
2021-01-30 15:36:47
1672
原创 C语言基础之运算符优先级
优先级 运算符 名称或含义 使用形式 结合方向 说明 1 [] 数组下标 数组名[常量表达式] 左到右 () 圆括号 (表达式)/函数名(形参表) . ...
2021-01-29 16:05:28
519
1
原创 C语言基础之const static
以下哪一个初始化操作不合法:int i = -1;const int ic = i;const int *pic = ⁣// int *const cpi = ⁣// compile error// cannot initialize a variable of type 'int *const'// with can rvalue of type 'const int *'int main(){ return 0;}...
2021-01-29 15:57:01
1172
1
原创 c++面向对象2
int init(const std::string & info){ std::cout << info << std::endl; return 0;}class A{ int m_x;public: A():m_x(init("Init A::m_x")) {init("Call A::A()");}};class A1:public A{ int m_y; int m_x;public...
2021-01-29 13:17:13
433
原创 重载 覆盖 隐藏
调用重载的顺序void myfunc(char a){ cout<<"myfunc char"<<endl;}//*void myfunc(int a){ cout<<"myfunc int"<<endl;} //*///*void myfunc(long a){ cout<<"myfunc long"<<endl;} //*/int main(){ unsigne
2021-01-29 11:34:00
754
原创 struct和class区别、三种继承及虚继承、友元类
之前只知道在C++中类和结构体的区别只有默认的防控属性(访问控制)不同,struct是public的,而class是private的。但经过上网查资料才发现,除了这个不同之外,还有很多的知识点需要掌握。下面就听我一一道来~1、首先比较一下C中的结构体和C++中的结构体区别C++中的struct是对C中的struct进行了扩充,所以增加了很多功能,主要的区别如下图所示:上面罗列了在声明时的区别,在使用的过程中也有区别:在C中使用结构体时需要加上struct,或者对结构体使用typedef..
2021-01-28 19:33:16
1882
原创 c基本函数
c语言获取程序时间#include <sys/time.h>#include <stdio.h>#include <unistd.h>int main(){ struct timeval tv; gettimeofday(&tv, NULL); printf("second: %ld\n", tv.tv_sec); // 秒 printf("millisecond: %ld\n", tv.tv_sec * 1000 + ...
2021-01-28 15:41:23
180
原创 c++面向对象1
类中调用自己的成员 虚函数。class CParent{public: CParent() {Print();}//step2 virtual ~CParent() {}public: virtual void Print() { std::cout << "1,";//step3 } void print1() {Print();}//step2};class CSon : public CParent{publ.
2021-01-28 14:55:45
1371
原创 stl 函数
https://blog.youkuaiyun.com/o_ohello/article/details/88636667string转化大小写#include<bits/stdc++.h>#include<string>using namespace std;int main(){ string s = "AakoOO"; transform(s.begin(), s.end(), s.begin(), ::toupper); cout<&...
2021-01-25 09:59:38
122
原创 数组 指针
//以下代码输出12、//行4列#include <iostream>int main(){double alpha[][4] = { {0}, {1,2}, {3,4,5} };std::cout << sizeof(alpha) / sizeof(double);return 0;}
2021-01-22 14:10:12
726
原创 二叉树的性质
等差数列通项公式、求和公式 等比数列通项公式、求和公式 https://www.cnblogs.com/yeqluofwupheng/p/7428935.html一、树的概念树是一些点的集合,这个集合可以为空,若不为空,则它是由一个根节点和0个或多个为空的子树组成,且每个子树都被一条来自根节点的有向边相连。树叶:没有儿子的节点;兄弟:具有相同父亲的节点;类似还有祖父和孙子节点。路径:节点n1,n2,n3,...,nk的一个序列,使得对于1 <= ...
2021-01-22 11:34:34
864
原创 std::copy std::move
https://www.cnblogs.com/xuhuajie/p/11491924.htmlvoid fun(int T)void fun(int* t)oid fun(int& T)void fun(int && T)之前的参数,值传递,指针传递,引用传递。现在呢?多了一个叫 “右值引用”的玩意,多了一种参数类型的选择。仅此而已。那他们号称的右值引用速度快,代价小呢?https://blog.youkuaiyun.com/HelloZE...
2021-01-22 11:23:40
1167
原创 排序方法
#include <iostream>#include <string>#include <vector>#include <map>#include <list>#include <algorithm>#include <set>#include <stack>using namespace std;//冒泡排序template <typename T> void b...
2021-01-18 11:02:00
83
原创 tar命令总结
查看一级目录tar tf GaussDB-Kernel-V500R001C00-EULER-64bit-AGNET.tar.gz |awk -F"/" '{print $2}'|uniq
2020-07-18 12:58:28
495
转载 进程和线程的主要区别(总结)
进程和线程的主要区别(总结)2018年06月13日 10:11:52 kingdoooom 阅读数:30497版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.youkuaiyun.com/kuangsonghan/article/details/80674777根本区别:进程是操作系统资源分配的基本单位,而线程是任务调度和执行的基本单位在开销方面:每个进程都有独...
2019-01-23 12:04:12
410
转载 使用动态内存可能出现的问题总结(笔试题解析)
使用动态内存可能出现的问题总结(笔试题解析)2018年08月02日 15:56:19 Jeanne_ou 标签: C语言 内存访问 动态内存开辟 指针 函数调用 版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.youkuaiyun.com/Erica_ou/article/details/81361017 在使用动态内存分配程序中,常常会产生不易发现的错误,这其中...
2019-01-23 11:07:01
1831
转载 进程间通信(IPC)介绍
进程间通信(IPC)介绍 进程间通信(IPC,InterProcess Communication)是指在不同进程之间传播或交换信息。IPC的方式通常有管道(包括无名管道和命名管道)、消息队列、信号量、共享存储、Socket、Streams等。其中 Socket和Streams支持不同主机上的两个进程IPC。以Linux中的C语言编程为例。 五种通讯方式总结...
2019-01-23 10:59:32
279
转载 C++与QML交互,把C++对象特性暴露到QML中
QQuickView是显示QtQuick用户界面的窗口。 它的基类是QQuickWindow,通过指定qml源文件的路径自动加载和显示QML场景。另一种方法是使用QQuickWindow和QQmlComponent配合加载QML。QQuickView *view = new QQuickView;view->setSource(QUrl::fromLocalFile("myqmlfile.
2017-09-18 16:16:54
567
转载 QML入门必知教程
本文由高频DNA翻译整理,转载请注明出处。本贴将不定时更新扩充内容,请点击原贴地址获得最新文章。QML文档与QML语法QML文档组成元素有:导入、对象树和注释QML文档结构包括两个部分:导入和对象树例子:/*这是一个QML文档的例子*/import QtQuick 2.0 //导入Rectangle { //根对象声明,对象树的根width: 100 //属
2017-09-18 16:12:21
2141
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人