随笔分类 - c++的心得体会
随笔,随笔,想到什么,写点什么了。
摘要:记录学习Windows下文件映射来共享内存 目的:探究共享内存区域是否可执行shellcode(让程序在共享内存以后弹出一个信息框) 实验过程: 1.获取MessageBox和ExitProcess的地址。 避免程序弹出信息框后崩溃或者中断。 代码: #include<iostream> #incl
阅读全文
摘要:利用_popen(),把控制台当做文件一样读写。暂时还不知道有什么特别的用处,不过能读取控制台输出就好了。 只读 #include<iostream> #include<string.h> using namespace std; int main() { FILE* file; char cmd[
阅读全文
摘要:话不多说,首先贴代码,代码主体参考自一本关于黑客技术的书,书名给忘了。 当时只是敲出来跟着用,也没有深入理解,最近再看,才发现一些原理。 Inline Hook的好处就是可以获取被Hook函数的参数,我们可以自行处理这些数据,再调用本来的Hook函数。 #include <stdio.h> #inc
阅读全文
摘要:刷的leetcode中的题,其实之前写过一篇,不过当时的写法比较傻,遇见矩阵大一点的貌似就有问题。 这次再刷到一样的题目,就重新写了一下。 给你一个正整数 n ,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的 n x n 正方形矩阵 matrix 。 思路: 一圈一圈的递归走下去
阅读全文
摘要:问题描述 对于一个 n 行 m 列的表格,我们可以使用螺旋的方式给表格依次填上正整数,我们称填好的表格为一个螺旋矩阵。 例如,一个 4 行 5 列的螺旋矩阵如下: 1 2 3 4 5 14 15 16 17 6 13 20 19 18 7 12 11 10 9 8 输入格式 输入的第一行包含两个整数
阅读全文
摘要:1 //c++给定字符分割 2 #include<iostream> 3 #include<vector> 4 #include<string.h> 5 using namespace std; 6 int main() 7 { 8 /* 最终把要分割的字符串根据给定分隔符划分为多个短的字符串*/
阅读全文
摘要:1 //char数组和string的转换 2 #include<iostream> 3 #include<string.h> 4 using namespace std; 5 int main() 6 { 7 char ch[]="hello world"; 8 // string s=ch;/*
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 int n; 4 void print(int *a) 5 { 6 for(int i=0;i<n;i++) 7 { 8 cout<<a[i]<<" "; 9 } 10 cout<<endl; 11 } 12
阅读全文
摘要:map左边只有结构体指针时,地址分配由创建顺序由大到小,map左边排序按照指针地址数值大小由大到小进行排序,不同于平时的由小到大。 1 #include<iostream> 2 #include<map> 3 using namespace std; 4 typedef struct tree* T
阅读全文
摘要:/* auto赋值只是暂时有效,iterator赋值才是真实有效地*/ /* 不只是vector,所有能用迭代器的容器应该都具有这个特点*/ 1 #include<iostream> 2 #include<vector> 3 using namespace std; 4 int main() 5 {
阅读全文
摘要:纸上得来终觉浅,绝知此事要躬行。 1 #include<iostream> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 int main() 6 { 7 int a[5]; 8 memset(a,257,20
阅读全文
摘要:1 #include<iostream> 2 using namespace std; 3 struct tree{ 4 int num; 5 string s; 6 bool operator<(const tree &a)const 7 { 8 return a.num<num; 9 } 10
阅读全文
摘要:1 #include<iostream> 2 #include<queue> 3 using namespace std; 4 struct tree{ 5 int num; 6 string s; 7 tree(int x,string zfc) 8 { 9 num=x; 10 s=zfc; 11
阅读全文
摘要:1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 struct tree{ 5 string zfc; 6 int a; 7 /*bool operator<(const tree &a) 8 { 9 if(zfc
阅读全文
摘要:1 #include<iostream> 2 #include<map> 3 using namespace std; 4 struct dian{ 5 int x,y; 6 /*bool operator<(const dian &a) const 7 { 8 return a.x>x; 9 }*
阅读全文
摘要:1 #include<iostream> 2 #include<set> 3 using namespace std; 4 struct dian{ 5 int x,y; 6 /*bool operator<(const dian &a) const 7 { 8 return x<a.x; 9 }*
阅读全文
摘要:1 #include<iostream> 2 #include<queue> 3 using namespace std; 4 struct dian{ 5 int x; 6 int y; 7 }; 8 /* 为了说明queue里面的数据类型可以通用,随便定义了一个结构体*/ 9 void prin
阅读全文
浙公网安备 33010602011771号