当前位置: 首页 > news >正文

STL常用遍历,查找,算法

目录

1.遍历算法

 1.1for_earch

1.2transform

2.常用查找算法

2.1find,返回值是迭代器

2.1.1查找内置数据类型 

 2.1.2查找自定义数据类型

2.2fin_if 按条件查找元素

2.2.1查找内置的数据类型

2.2.2查找内置数据类型

2.3查找相邻元素adjeacent_find

2.4查找指定元素是否存在binarary_search

2.5统计元素的个数count

 2.5.1统计内置数据类型

2.5.2统计自定义数据类型

2.6按条件统计元素个数

2.6.1统计内置数据类型 

2.6.2统计自定义的数据类型

3.常用排序算法

3.1sort


1.遍历算法

 1.1for_earch

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用遍历算法 for_each//利用普通函数实现
void print01(int val)
{cout << val << " ";
}//仿函数(函数对象)本身是个类。不是一个函数
class print02
{
public:void operator()(int val){cout << val << " ";}
};
void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}for_each(v.begin(), v.end(), print01);//第三个位置,普通函数是把函数名放过来cout << endl;for_each(v.begin(), v.end(), print02());//第三个位置需要传入函数对象//类名加小括号,创建出匿名对象
}
int main()
{test01();system("pause");return 0;
}

1.2transform

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用遍历算法 transform//仿函数(函数对象)本身是个类。不是一个函数
class Transform
{
public://搬运过程中把每个元素取出来在返回回去,由于操作的是int型,所以返回intint operator()(int val){return val+100;//+100在搬到容器中}
};
class Myprint
{
public:void operator()(int val){cout << val << " ";}
};
void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}vector<int>vTarget;//目标容器vTarget.resize(v.size());//目标容器 需要提前开辟空间,不然报错transform(v.begin(), v.end(), vTarget.begin(), Transform());//最后一个位置函数对象for_each(vTarget.begin(), vTarget.end(), Myprint());//最后一个位置函数对象cout << endl;
}
int main()
{test01();system("pause");return 0;
}

2.常用查找算法

2.1find,返回值是迭代器

2.1.1查找内置数据类型 

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
#include<string>
//常用查找算法 
//find//查找 内置数据类型
void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}//查找 容器中 是否有 5 这个元素vector<int>::iterator it = find(v.begin(), v.end(), 50);if (it == v.end()){cout << "没有找到!" << endl;}else{cout << "找到:" << *it << endl;}
}int main()
{test01();system("pause");return 0;
}

 2.1.2查找自定义数据类型

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
#include<string>
//常用查找算法 
//findclass Person
{
public:Person(string name, int age){m_Name = name;this->m_Age = age;}//重载== 让底层find知道如何对比person数据类型bool operator ==(const Person& p)//const防止修改p{if (this->m_Name == p.m_Name && this->m_Age == p.m_Age){return true;}else{return false;}}string m_Name;int m_Age;
};
//查找 自定义数据类型
void test02()
{vector<Person>v;//创建数据Person p1("aaa", 10);Person p2("bbb", 20);Person p3("ccc", 30);Person p4("ddd", 40);//放到容器中v.push_back(p1);v.push_back(p2);v.push_back(p3);v.push_back(p4);Person p("bbb", 20);//查找是否有和p一样的vector<Person>::iterator it = find(v.begin(), v.end(), p);if (it == v.end()){cout << "没有找到" << endl;}else{cout << "找到元素:姓名:" << (*it).m_Name << " 年龄:" << it->m_Age << endl;}}
int main()
{test02();system("pause");return 0;
}

2.2fin_if 按条件查找元素

2.2.1查找内置的数据类型

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
#include<string>
//常用查找算法 
//find_if//1.查找内置数据类型
class GreaterFive
{
public://谓词返回boolbool operator()(int val)//find_if的底层也是取出每个元素并解引用,放到重载小括号里去操纵{return val > 5;//大于5 的时候就返回真}
};
void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}//返回一个迭代器vector<int>::iterator it=find_if(v.begin(), v.end(), GreaterFive());//第三个位置是匿名函数对象if (it == v.end()){cout << "没有找到大于5的元素" << endl;}else{cout << "找到大于5的数字为:" << *it << endl;}
}//2.查找自定义数据类型int main()
{test01();system("pause");return 0;
}

2.2.2查找内置数据类型

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
#include<string>
//常用查找算法 
//find_if//2.查找自定义数据类型
class Person
{
public:Person(string name, int age){m_Name = name;this->m_Age = age;}string m_Name;int m_Age;
};
class Great20
{
public:bool operator()(Person &p)//每个数据类型都是Perosn的数据类型用引用的方式传进来{return p.m_Age > 20;}
};
bool G2(Person& p)
{return p.m_Age > 20;
}
void test02()
{vector<Person>v;//创建数据Person p1("aaa", 10);Person p2("bbb", 20);Person p3("ccc", 30);Person p4("ddd", 40);v.push_back(p1);v.push_back(p2);v.push_back(p3);v.push_back(p4);//找年龄大于20的人vector<Person>::iterator it = find_if(v.begin(), v.end(), Great20());if (it == v.end()){cout << "没有找到" << endl;}else{cout << "找到姓名:" << (*it).m_Name << "年龄:" << it->m_Age << endl;}vector<Person>::iterator it1 = find_if(v.begin(), v.end(), Great20());if (it1 == v.end()){cout << "没有找到" << endl;}else{cout << "找到姓名:" << (*it1).m_Name << "年龄:" << it1->m_Age << endl;}
}
int main()
{test02();system("pause");return 0;
}

2.3查找相邻元素adjeacent_find

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用查找算法 
//adjacent_find
void test01()
{vector<int>v;v.push_back(0);v.push_back(2);v.push_back(0);v.push_back(3);v.push_back(1);v.push_back(4);v.push_back(3);v.push_back(3);vector<int>::iterator it=adjacent_find(v.begin(), v.end());if (it == v.end()){cout << "未找到相邻重复元素" << endl;}else{cout << "找到相邻重复元素:" << *it << endl;}
}int main()
{test01();system("pause");return 0;
}

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用查找算法 
//binary_search 二分查找法,在无序的序列中不可以用
void test01()
{vector<int>v;for (int i = 0; i < 10; i++){v.push_back(i);}//查找容器中是否有9//注意容器必须是有序的序列//如果无序结果未知bool ret = binary_search(v.begin(), v.end(), 9);if (ret){cout << "找到了元素" << endl;}else{cout << "没找到" << endl;}
}int main()
{test01();system("pause");return 0;
}

2.5统计元素的个数count

 2.5.1统计内置数据类型

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用查找算法 
//count//1.统计内置数据类型
void test01()
{vector<int>v;v.push_back(10);v.push_back(40);v.push_back(30);v.push_back(40);v.push_back(20);v.push_back(40);int num=count(v.begin(), v.end(), 40);cout << "40的元素个数为:" <<num<< endl;int num1 = count(v.begin(), v.end(), 1);cout << "1的元素个数为:" << num1 << endl;//输出0
}int main()
{test01();system("pause");return 0;
}

2.5.2统计自定义数据类型

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用查找算法 
//count//2.统计自定义数据类型
class Person
{
public:Person(string name, int age){m_Name = name;this->m_Age = age;}bool operator==(const Person& p)//底层要加const,{if (m_Age==p.m_Age){return true;}else{return false;}}string m_Name;int m_Age;
};
void test02()
{vector<Person>v;Person p1("刘备", 35);Person p2("关羽", 35);Person p3("张飞", 35);Person p4("赵云", 30);Person p5("曹操", 40);//将人员插入到容器中v.push_back(p1);v.push_back(p2);v.push_back(p3);v.push_back(p4);v.push_back(p5);Person p("诸葛亮", 35);//统计与诸葛亮年龄相同的有几人int num = count(v.begin(), v.end(), p);cout << "和诸葛亮同岁数的人员个数为:" << num << endl;
}int main()
{test02();system("pause");return 0;
}

2.6按条件统计元素个数

2.6.1统计内置数据类型 

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用查找算法 
//count_if//1.统计内置数据类型
class Greater20
{
public:bool operator()(int val){return val > 20;}
};
void test01()
{vector<int>v;v.push_back(10);v.push_back(40);v.push_back(30);v.push_back(20);v.push_back(40);v.push_back(20);int num = count_if(v.begin(), v.end(), Greater20());cout << "大于20的元素个数为:" << num << endl;
}int main()
{test01();system("pause");return 0;
}

2.6.2统计自定义的数据类型

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用查找算法 
//count_if//2.统计自定义的数据类型
class Person
{
public:Person(string name, int age){m_Name = name;this->m_Age = age;}string m_Name;int m_Age;
};class AgeGreater20
{
public:bool operator()(Person &p){return p.m_Age > 20;}
};void test02()
{vector<Person>v;Person p1("刘备", 35);Person p2("关羽", 35);Person p3("张飞", 35);Person p4("赵云", 40);Person p5("曹操", 20);v.push_back(p1);v.push_back(p2);v.push_back(p3);v.push_back(p4);v.push_back(p5);//统计 大于20岁人员个数int num = count_if(v.begin(), v.end(), AgeGreater20());cout << "大于20的元素个数为:" << num << endl;
}int main()
{test02();system("pause");return 0;
}

3.常用排序算法

3.1sort

#include<iostream>
using namespace std;
#include<vector>
#include<algorithm>
//常用排序算法 
//sort
void myPrint(int val)
{cout << val << " ";
}
void test01()
{vector<int>v;v.push_back(10);v.push_back(30);v.push_back(50);v.push_back(20);v.push_back(40);//利用sort进行升序,默认情况下升序sort(v.begin(), v.end());for_each(v.begin(), v.end(), myPrint);cout << endl;//改变为降序sort(v.begin(), v.end(), greater<int>());//greater<int>()内建函数对象,需要包含functional头文件,编译器高的不包含functional头文件也不会出错for (int i = 0; i < v.size(); i++){cout << v[i] << " ";}cout << endl;
}int main()
{test01();system("pause");return 0;
}
bool compare(int a,int b) 
{ return a < b; //升序排列,如果改为return a>b,则为降序 
} 
int a[20]={2,4,1,23,5,76,0,43,24,65},i; 
for(i=0;i<20;i++) cout<< a[i]<< endl; 
sort(a,a+20,compare);
#include<iostream>
using namespace std;
#include<stack>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<queue>
#include<set>
#include<map>struct Point 
{int x;int y;//Point(int xx, int yy) :x(xx), y(yy) {};bool operator < (Point& p) {if (x != p.x) {return x < p.x;} else {return y < p.y;}}
};int main()
{vector<Point> p;p.push_back(Point{ 1,2 });p.push_back(Point{ 1,3 });Point p1;p1.x = 2;p1.y = 1;p.push_back(p1);sort(p.begin(), p.end());for (int i = 0; i < p.size(); i++) {cout << p[i].x << " " << p[i].y << endl;}/*输出:1 21 32 1*/system("pause");return 0;
}--------------------------------------------------------------------------------------struct Point 
{int x;int y;
};
bool Cmp(Point& p1, Point& p2) {if (p1.x != p2.x) {return p1.x < p2.x;} else {return p1.y < p2.y;}
}int main()
{vector<Point> p;p.push_back(Point{ 1,2 });p.push_back(Point{ 1,3 });Point p1;p1.x = 2;p1.y = 1;p.push_back(p1);sort(p.begin(), p.end(),Cmp);for (int i = 0; i < p.size(); i++) {cout << p[i].x << " " << p[i].y << endl;}/*输出:1 21 32 1*/system("pause");return 0;
}
----------------------------------------------------------------------------------------struct Point
{int x;int y;
};
class cmp
{
public:bool operator()(Point& p1, Point& p2)const {if (p1.x != p2.x) {return p1.x < p2.x;} else {return p1.y < p2.y;}}
};int main()
{vector<Point> p;p.push_back(Point{ 1,2 });p.push_back(Point{ 1,3 });Point p1;p1.x = 2;p1.y = 1;p.push_back(p1);sort(p.begin(), p.end(), cmp());for (int i = 0; i < p.size(); i++) {cout << p[i].x << " " << p[i].y << endl;}/*输出:1 21 32 1*/system("pause");return 0;
}

相关文章:

STL常用遍历,查找,算法

目录 1.遍历算法 1.1for_earch 1.2transform 2.常用查找算法 2.1find&#xff0c;返回值是迭代器 2.1.1查找内置数据类型 2.1.2查找自定义数据类型 2.2fin_if 按条件查找元素 2.2.1查找内置的数据类型 2.2.2查找内置数据类型 2.3查找相邻元素adjeacent_find 2.4查找指…...

BCC源码内容概览(1)

接前一篇文章&#xff1a;BCC源码编译和安装 本文参考官网中的Contents部分的介绍。 BCC源码根目录的文件&#xff0c;其中一些是同时包含C和Python的单个文件&#xff0c;另一些是.c和.py的成对文件&#xff0c;还有一些是目录。 跟踪&#xff08;Tracing&#xff09; exam…...

mysql限制用户登录失败次数,限制时间

mysql用户登录限制设置 mysql 需要进行用户登录次数限制,当使用密码登录超过 3 次认证链接失败之后,登录锁住一段时间,禁止登录这里使用的 mysql: 8.1.0 这种方式不用重启数据库. 配置: 首先进入到 mysql 命令行:然后需要安装两个插件: 在 mysql 命令行中执行: mysql> INS…...

从利用Arthas排查线上Fastjson问题到Java动态字节码技术(下)

上一篇从Arthas的源码引出了Java动态字节码技术&#xff0c;那么这一篇就从几种Java字节码技术出发&#xff0c;看看Arthas是如何通过动态字节码技术做到无侵入的源码增强&#xff1b; Java大部分情况下都是解释执行的&#xff0c;也就是解释.class文件&#xff0c;所以如果我们…...

Ubuntu中安装Anaconda 如何将 路径导入为全局变量

第一步&#xff1a;将你的anaconda 路径复制下来&#xff0c;在终端输入对应路径。 echo export PATH"/home/你的用户名/anaconda3/bin:$PATH" >> ~/.bashrc 第二步&#xff1a;在终端输入下面命令或者重启系统。 source ~/.bashrc 在对应的anaconda安装目…...

【QT】Qt的随身笔记(持续更新...)

目录 Qt 获取当前电脑桌面的路径Qt 获取当前程序运行路径Qt 创建新的文本文件txt&#xff0c;并写入内容如何向QPlainTextEdit 写入内容QTimerQMessageBox的使用QLatin1StringQLayoutC在c头文件中写#include类的头文件与直接写class加类名有何区别mutable关键字前向声明 QFontQ…...

【LeetCode-简单题】589. N 叉树的前序遍历

文章目录 题目方法一&#xff1a;单循环栈做法方法二&#xff1a;递归 题目 方法一&#xff1a;单循环栈做法 关键在于子节点的入栈顺序&#xff0c;决定了子节点的出栈顺序&#xff0c; 因为是前序遍历 所以压栈顺序先让右边的入栈 依次往左 这样左边的节点会在栈顶 这样下次…...

Linphone3.5.2 ARM RV1109音视频对讲开发记录

Linphone3.5.2 ARM RV1109音视频对讲开发记录 说明 这是一份事后记录&#xff0c;主要记录的几个核心关键点&#xff0c;有可能很多细节没有记上&#xff0c;主要是方便后面自己再找回来! 版本 3.5.2 一些原因选的是这样一个旧的版本&#xff01; 新的开发最好选新一些的版…...

Unity用相机实现的镜子效果

首先登场 场景中的元素 mirror是镜子&#xff0c;挂着我们的脚本&#xff0c;Quad是一个面片。Camera是用来生成RenderTexture给面片的。里面的test1是我用来调试位置的球。 镜子size是大小&#xff0c;x是-2&#xff0c;为了反转一下贴图 相机直接可以禁用掉&#xff0c;用…...

计算机网络分类

按照覆盖范围分类 &#xff08;1&#xff09;个域网&#xff1a;通常覆盖范围在1&#xff5e;10m。 &#xff08;2&#xff09;局域网&#xff1a;通常覆盖范围在10m&#xff5e;1km。 &#xff08;3&#xff09;城域网&#xff1a;覆盖范围通常在5&#xff5e;50 km 。 &…...

AI AIgents时代 - (三.) AutoGPT和AgentGPT

前两篇讲解了Agent的原理和组件&#xff0c;这节我将给大家介绍两个agent项目&#xff0c;给出它们的工作原理和区别&#xff0c;并教大家亲手尝试使用 Agents&#x1f389; &#x1f7e2; AutoGPT&#x1f916;️ 我们的老朋友&#xff0c;之前文章也专门写过。AutoGPT 是一…...

Jmeter接口自动化和Python接口自动化,如何选择?

选择Jmeter或Python进行接口自动化测试取决于您的具体需求和环境。以下是一些可以考虑的因素&#xff1a; 1. 语言熟悉度&#xff1a;如果您对Java更熟悉&#xff0c;那么Jmeter可能是更好的选择。而如果您的团队或个人对Python更熟悉&#xff0c;那么Python可能是更好的选择。…...

Sqilte3初步教程

文章目录 安装创建数据库创建和删除表插入行数据 安装 Windows下安装&#xff0c;首先到下载页面&#xff0c;下载Windows安装软件&#xff0c;一般是 sqlite-dll-win32-*.zip sqlite-tools-win32-*.zip下载之后将其内容解压到同一个文件夹下&#xff0c;我把它们都放在了D:\…...

详解Python中的json库

目录 1. json简介2. dumps/loads3. dump/load4. jsonl格式 1. json简介 JSON&#xff08;JavaScript Object Notation&#xff09;是一种轻量级的数据交换格式&#xff0c;用于在不同应用程序之间传递数据。它是一种文本格式&#xff0c;易于阅读和编写&#xff0c;同时也易于…...

【Spring Boot】Spring Boot源码解读与原理剖析

这里写目录标题 前言精进Spring Boot首选读物“小册”变“大书”&#xff0c;彻底弄懂Spring Boot全方位配套资源&#xff0c;学不会来找我&#xff01;技术新赛道&#xff0c;2023领先抢跑 前言 承载着作者的厚望&#xff0c;掘金爆火小册同名读物《Spring Boot源码解读与原理…...

C++学习(1)

一、C概述&#xff08;了解&#xff09; C在C语言的基础上添加了面向对象编程和泛型编程的支持 二、helloword程序&#xff08;掌握&#xff09; #define _CET_SECURE_NO_WARNINGS//在开发软件visual studio编译 c文件时, visual studio认为strcpy,scanf等函数不安全的导致报…...

机器人如何有效采摘苹果?

摘要&#xff1a;本文利用动捕数据构建拟人运动模型&#xff0c;对比观察两种苹果采摘模式&#xff0c;并对系统性能进行全面评估&#xff0c;为提高机器人采摘效率提供创新方法。 近期&#xff0c;一项关于苹果采摘机器人的有趣研究—— "Design and evaluation of a rob…...

C# OpenCvSharp Yolov8 Detect 目标检测

效果 项目 代码 using OpenCvSharp; using OpenCvSharp.Dnn; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;namespace Open…...

rust数组

一、定义数组 &#xff08;一&#xff09;一维数组 1.指定所有元素 语法格式 let variable_name: [dataType; size] [value1,value2,value3];例如 let arr: [i32; 4] [10,20,30,40];2.指定初始值和长度 所有元素具有相同的值 语法格式 let variable_name: [dataType; siz…...

ubuntu | 安装NVIDIA套件:驱动、CUDA、cuDNN

CUDA 查看支持最高的cuda版本 nvidia-smiCUDA Version:12.2 区官网下在12.2.x最新的版本即可CUDA Toolkit Archive | NVIDIA Developer 下载安装 wget https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_535.104.05_linux.run sudo…...

OpenLayers 可视化之热力图

注&#xff1a;当前使用的是 ol 5.3.0 版本&#xff0c;天地图使用的key请到天地图官网申请&#xff0c;并替换为自己的key 热力图&#xff08;Heatmap&#xff09;又叫热点图&#xff0c;是一种通过特殊高亮显示事物密度分布、变化趋势的数据可视化技术。采用颜色的深浅来显示…...

23-Oracle 23 ai 区块链表(Blockchain Table)

小伙伴有没有在金融强合规的领域中遇见&#xff0c;必须要保持数据不可变&#xff0c;管理员都无法修改和留痕的要求。比如医疗的电子病历中&#xff0c;影像检查检验结果不可篡改行的&#xff0c;药品追溯过程中数据只可插入无法删除的特性需求&#xff1b;登录日志、修改日志…...

8k长序列建模,蛋白质语言模型Prot42仅利用目标蛋白序列即可生成高亲和力结合剂

蛋白质结合剂&#xff08;如抗体、抑制肽&#xff09;在疾病诊断、成像分析及靶向药物递送等关键场景中发挥着不可替代的作用。传统上&#xff0c;高特异性蛋白质结合剂的开发高度依赖噬菌体展示、定向进化等实验技术&#xff0c;但这类方法普遍面临资源消耗巨大、研发周期冗长…...

【Web 进阶篇】优雅的接口设计:统一响应、全局异常处理与参数校验

系列回顾&#xff1a; 在上一篇中&#xff0c;我们成功地为应用集成了数据库&#xff0c;并使用 Spring Data JPA 实现了基本的 CRUD API。我们的应用现在能“记忆”数据了&#xff01;但是&#xff0c;如果你仔细审视那些 API&#xff0c;会发现它们还很“粗糙”&#xff1a;有…...

学习STC51单片机32(芯片为STC89C52RCRC)OLED显示屏2

每日一言 今天的每一份坚持&#xff0c;都是在为未来积攒底气。 案例&#xff1a;OLED显示一个A 这边观察到一个点&#xff0c;怎么雪花了就是都是乱七八糟的占满了屏幕。。 解释 &#xff1a; 如果代码里信号切换太快&#xff08;比如 SDA 刚变&#xff0c;SCL 立刻变&#…...

如何在网页里填写 PDF 表格?

有时候&#xff0c;你可能希望用户能在你的网站上填写 PDF 表单。然而&#xff0c;这件事并不简单&#xff0c;因为 PDF 并不是一种原生的网页格式。虽然浏览器可以显示 PDF 文件&#xff0c;但原生并不支持编辑或填写它们。更糟的是&#xff0c;如果你想收集表单数据&#xff…...

A2A JS SDK 完整教程:快速入门指南

目录 什么是 A2A JS SDK?A2A JS 安装与设置A2A JS 核心概念创建你的第一个 A2A JS 代理A2A JS 服务端开发A2A JS 客户端使用A2A JS 高级特性A2A JS 最佳实践A2A JS 故障排除 什么是 A2A JS SDK? A2A JS SDK 是一个专为 JavaScript/TypeScript 开发者设计的强大库&#xff…...

C++课设:简易日历程序(支持传统节假日 + 二十四节气 + 个人纪念日管理)

名人说:路漫漫其修远兮,吾将上下而求索。—— 屈原《离骚》 创作者:Code_流苏(CSDN)(一个喜欢古诗词和编程的Coder😊) 专栏介绍:《编程项目实战》 目录 一、为什么要开发一个日历程序?1. 深入理解时间算法2. 练习面向对象设计3. 学习数据结构应用二、核心算法深度解析…...

Git常用命令完全指南:从入门到精通

Git常用命令完全指南&#xff1a;从入门到精通 一、基础配置命令 1. 用户信息配置 # 设置全局用户名 git config --global user.name "你的名字"# 设置全局邮箱 git config --global user.email "你的邮箱example.com"# 查看所有配置 git config --list…...

[ACTF2020 新生赛]Include 1(php://filter伪协议)

题目 做法 启动靶机&#xff0c;点进去 点进去 查看URL&#xff0c;有 ?fileflag.php说明存在文件包含&#xff0c;原理是php://filter 协议 当它与包含函数结合时&#xff0c;php://filter流会被当作php文件执行。 用php://filter加编码&#xff0c;能让PHP把文件内容…...