C# 关于LoadLibrary的疑问详解

关于 LoadLibrary 的疑问Win32 API 中 LoadLibrary 函数的功能是加载某个库文件(通常是 dll 文件),然后返回 HMODULE 句柄,可以使用两个这个句柄来调用dll中的导出函数,一切似乎...

2021-10-10

C++实现LeetCode(648.替换单词)

[LeetCode] 648.Replace Words 替换单词In English, we have a concept called root, which can be followed by some other words to form another longer word - let...

2021-10-05

C语言进阶教程之循环语句缺陷详析

目录前言1 循环语句的三要素
2 使用不同循环语句实现六种排列组合
2.1 第一种排列(ABC)
2.2 第二种排列(ACB)
2.3 第三种排列(BCA)
2.4 第四种排列(CBA)
2.5 第五种排列(BAC)
2.6 第六...

2021-10-05

C++实现LeetCode(237.删除链表的节点)

[LeetCode] 237.Delete Node in a Linked List 删除链表的节点Write a function to delete a node (except the tail) in a singly linked list, given only access to that...

2021-10-05

C++实现LeetCode(186.翻转字符串中的单词之二)

[LeetCode] 186. Reverse Words in a String II 翻转字符串中的单词之二Given an input string , reverse the string word by word. Example:Input:  ["t",...

2021-10-05

Pipes实现LeetCode(194.转置文件)

[LeetCode] 194.Transpose File 转置文件Given a text file file.txt, transpose its content.You may assume that each row has the same number of columns and eac...

2021-10-05

C++实现LeetCode(692.前K个高频词)

[LeetCode] 692.Top K Frequent Words 前K个高频词Given a non-empty list of words, return the k most frequent elements.Your answer should be sorted by fr...

2021-10-05

C语言:传值与传址交换整数

目录传值调用传址调用总结传值调用要想交换两个整数的值,我们可以自定义一个函数,来实现这个过程。具体代码如下:#include <stdio.h>void Swap1(int x, int y){ int z = 0; z =...

2021-10-05

C++实现LeetCode(188.买卖股票的最佳时间之四)

[LeetCode] 188.Best Time to Buy and Sell Stock IV 买卖股票的最佳时间之四Say you have an array for which the&#160;ith&#160;element is the price of a given stock...

2021-10-05

C++野指针和悬空指针的实现方法

目录一、野指针
二、悬空指针
2.1 情况一
2.2 情况二
2.3 情况三
野指针和悬空指针是指针中常见的两个概念,本文结合实例讲解来讲解下。一、野指针
野指针是指尚未初始化的指...

2021-10-05

示例详解C++语言中的命名空间 (namespace)

目录前言1. 命名空间
2. using 指令
3. 不连续的命名空间
4. 嵌套的命名空间
5. 命名空间内变量、函数、全局变量的作用域5.1 using namespace first_space;5.2 using names...

2021-10-05

C++实现LeetCode(191.位1的个数)

[LeetCode] 191.Number of 1 Bits 位1的个数Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the&#160;Hammi...

2021-10-05

C++实现LeetCode(642.设计搜索自动补全系统)

[LeetCode] 642. Design Search Autocomplete System 设计搜索自动补全系统Design a search autocomplete system for a search engine. Users may input a sentence (at le...

2021-10-05

C++11智能指针unique_ptr用法使用场景分析

一、概述C++ 标准模板库 STL(Standard Template Library) 一共给我们提供了四种智能指针:auto_ptr、unique_ptr、shared_ptr 和 weak_ptr,其中 auto_ptr 是 C++98 提出的,C++11...

2021-10-05

C++实现LeetCode(347.前K个高频元素)

[LeetCode] 347. Top K Frequent Elements 前K个高频元素Given a non-empty array of integers, return the&#160;k&#160;most frequent elements.Example 1:Input: nums =...

2021-10-05

C++实现LeetCode(207.课程清单)

[LeetCode] 207. Course Schedule 课程清单There are a total of&#160;n&#160;courses you have to take, labeled from&#160;0&#160;to&#160;n-1.Some courses may have pr...

2021-10-05

C++实现LeetCode(190.颠倒二进制位)

[LeetCode] 190. Reverse Bits 颠倒二进制位Reverse bits of a given 32 bits unsigned integer.Example 1:Input: 00000010100101000001111010011100
Output: 001110010111...

2021-10-05

C++实现LeetCode(676.实现神奇字典)

[LeetCode] 676.Implement Magic Dictionary 实现神奇字典Implement a magic directory with&#160;buildDict, and&#160;search&#160;methods.For the method&#160;buildDic...

2021-10-05

Pipes实现LeetCode(193.验证电话号码)

[LeetCode] 193.Valid Phone Numbers 验证电话号码Given a text file file.txt that contains list of phone numbers (one per line), write a one liner bash script to p...

2021-10-05

C++实现LeetCode(203.移除链表元素)

[LeetCode] 203.Remove Linked List Elements 移除链表元素Remove all elements from a linked list of integers that have value val.Example
Given: 1 --> 2 --> 6 --> 3...

2021-10-05

一文掌握C++ 智能指针全部用法

目录一、为什么要使用智能指针二、auto_ptr三、unique_ptr四、shared_ptr五、weak_ptr六、智能指针的使用陷阱七、总结为什么要学习智能指针?
咳咳,这个问题不是问大家的,是询...

2021-10-05

C++实现LeetCode(198.打家劫舍)

[LeetCode] 198. House Robber 打家劫舍You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the...

2021-10-05

C++强制类型转换(static_cast、dynamic_cast、const_cast、reinterpret_cast)

目录1. c强制转换与c++强制转换
2. static_cast、dynamic_cast、const_cast、reinterpret_cast
dynamic_cast
const_cast
reinterpret_cast
3. c++强制转换注意事项
1. c强...

2021-10-05

C++手写内存池的案例详解

引言使用new expression为类的多个实例分配动态内存时,cookie导致内存利用率可能不高,此时我们通过实现类的内存池来降低overhead。从不成熟到巧妙优化的内存池,得益于union的...

2021-10-05

C++实现LeetCode(309.买股票的最佳时间含冷冻期)

[LeetCode] 309.Best Time to Buy and Sell Stock with Cooldown 买股票的最佳时间含冷冻期Say you have an array for which the ith element is the price of a given sto...

2021-10-05

C++ throw关键字实现抛出异常和异常规范

目录一个动态数组的例子
throw 用作异常规范
1) 虚函数中的异常规范
2) 异常规范与函数定义和函数声明
请抛弃异常规范,不要再使用它
在《C++异常入门》一节中,我们讲到了 C++...

2021-10-05

Pipes实现LeetCode(195.第十行)

[LeetCode] 195.Tenth Line 第十行How would you print just the 10th line of a file&#63;For example, assume that file.txt has the following content:Line 1
Line 2
L...

2021-10-05

C++合并二叉树的思路与示例代码

前言给定两个二叉树,想象当你将它们中的一个覆盖到另一个上时,两个二叉树的一些节点便会重叠。你需要将他们合并为一个新的二叉树。合并的规则是如果两个节点重叠,那么将他们的...

2021-10-05

浅谈C++类型转换几种情况

目录0. 类型转换的原理1. 初始化和赋值时进行的转换2. 以{}方式初始化时进行的转换(C++11新增)3. 表达式中的转换4. 传递参数时的转换5. 强制类型转换6. 使用auto让编译器自己...

2021-10-05

C++实现LeetCode(208.实现字典树(前缀树))

[LeetCode] 208. Implement Trie (Prefix Tree) 实现字典树(前缀树)Implement a trie with&#160;insert,&#160;search, and&#160;startsWith&#160;methods.Example:Trie tri...

2021-10-05

C++实现LeetCode(201.数字范围位相与)

[LeetCode] 201.Bitwise AND of Numbers Range 数字范围位相与Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this ra...

2021-10-05

c++实现版本层次遍历功能

采用队列实现,BFS,功能:BFS层次遍历打印、按照节点将BFS序列化成一个字符。#include <iostream>#include <string>#include <queue>using namespace std;struct TreeNode{ i...

2021-10-05

C++实现LeetCode(557.翻转字符串中的单词之三)

[LeetCode] 557.Reverse Words in a String III 翻转字符串中的单词之三Given a string, you need to reverse the order of characters in each word within a sentence wh...

2021-10-05

C++初阶之list的模拟实现过程详解

list的介绍
list的优点:
list头部、中间插入不再需要挪动数据,O(1)效率高 list插入数据是新增节点,不需要增容
list的缺点:
不支持随机访问,访问某个元素效率O(N...

2021-10-05

C++实现LeetCode(202.快乐数)

[LeetCode] 202.Happy Number 快乐数Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting w...

2021-10-05

Pipes实现LeetCode(192.单词频率)

[LeetCode] 192.Word Frequency 单词频率Write a bash script to calculate the frequency of each word in a text file words.txt.For simplicity sake, you may assume:...

2021-10-05

C++实现LeetCode(199.二叉树的右侧视图)

[LeetCode] 199.Binary Tree Right Side View 二叉树的右侧视图Given a binary tree, imagine yourself standing on the&#160;right&#160;side of it, return the values o...

2021-10-05

C++异常处理入门(try和catch)

目录捕获异常
发生异常的位置
开发程序是一项“烧脑”的工作,程序员不但要经过长期的知识学习和思维训练,还要做到一丝不苟,注意每一个细节和边界。即使这样,也不能防止程序出错...

2021-10-05

C语言版的三子棋游戏

本文实例为大家分享了C语言版三子棋游戏的具体代码,供大家参考,具体内容如下一、游戏说明三子棋相信大家都不陌生,小时候经常在纸上画出九宫格就可以直接和小伙伴一起玩,规则就...

2021-10-05

C++实现LeetCode(209.最短子数组之和)

[LeetCode] 209. Minimum Size Subarray Sum 最短子数组之和Given an array of&#160;n&#160;positive integers and a positive integer&#160;s, find the minimal length o...

2021-10-05

C语言指针原来也可以这样了解

目录什么是指针指针的应用指针 ± 整数指针 + 指针指针 - 指针野指针野指针成因指针和数组指针 ± 和数组的关系二级指针总结什么是指针指针是应该对象,可以直接指向电脑存储...

2021-10-05

C++实现LeetCode(210.课程清单之二)

[LeetCode] 210. Course Schedule II 课程清单之二There are a total of&#160;n&#160;courses you have to take, labeled from&#160;0&#160;to&#160;n-1.Some courses may...

2021-10-05

C语言中变参函数传参的实现示例

目录背景引入问题分析指针大小参数位置排布解决问题额外的测试总结参考资料背景引入近期在看一本书,叫做《嵌入式C语言自我修养》,写的内容对我帮助很大,是一本好书。在第6章,GN...

2021-10-05

老程序员教你一天时间完成C语言扫雷游戏

目录扫雷游戏1.菜单2.初始化棋盘3.打印棋盘4.布置雷5.排查雷6.整体效果展示7.代码分享7.1 test.c7.2 game.c7.3 game.h总结扫雷游戏今天我们就要设计一款这样的游戏,首先需要...

2021-10-05

一篇文章带你了解C语言浮点数之间的比较规则

目录你认为这段代码输出什么?为什么不等于呢?
应该怎么解决?那么怎么判断两个浮点数 f1 和 f2 相等呢。
伪代码可以简化为 >>怎么判断浮点数等于0?
还有一个问题
总结你认为这段...

2021-10-05

C++11各种锁的具体使用

目录Mutex(互斥锁)什么是互斥量(锁)?条件变量condition_variable:condition_variable的waitstd::shared_mutex原子操作Mutex(互斥锁)什么是互斥量(锁)?这样比喻:单位上有一台打印机(共享...

2021-10-05

C++11如何实现无锁队列

无锁操作的本质依赖的原子操作,C++11提供了atomic的原子操作支持atomiccompare_exchange_weak / compare_exchange_strong
当前值与期望值相等时,修改当前值为设定值,返回true...

2021-10-05

老程序员教你一天时间完成C++俄罗斯方块游戏

目录一、主要文件二、界面设计三、方块设计四、设计思路设计思路如下:五、总结首先,看下效果图:图1 游戏运行过程下面详细讲解下制作过程。一、主要文件文件包含三个:tetris.cpp...

2021-10-05

一篇文章带你使用C语言编写内核

目录gcc 命令文件头将内核载入内存总结gcc 命令 使用 gcc 编译 c语言
-c 编译、汇编到目标代码,不进行链接,也就是直接生成目标文件
-o 将输出的文件以指定文件名来储...

2021-10-05

c++ 对数器实现示例

目录对数器的作用对数器的实现代码
完整代码对数器的作用对数器用于在自己的本地平台验证算法正确性,用于算法调试,无需online judge。好处: 没找到线上测试的online judge,...

2021-10-05
返回顶部
顶部