随笔分类 - stl
摘要:1.头文件 #include<algorithm> 2.使用方法: #include<cstdio> #include<iostream> #include<algorithm> using namespace std; int main(){ int a,b,a1,b1,c,d; cin>>a>>
阅读全文
摘要:1.头文件#include<set> 2.功能:能够去重,和从小到大排序 用迭代器遍历,不能用q[i]来遍历 具体实现如下: #include<cstdio> #include<set> #include<iostream> using namespace std; int main(){ int
阅读全文
摘要:1.头文件:#include<cstring> 2. 功能: string s1; s.find(s1); 返回值是s1在母串s中首次出现的下标,若没有找到则会返回一个特殊字符
阅读全文
摘要:1.头文件: #include<cstring> 2. int a;//代表s的下标 string b//代表字符串 s1=s.insert(a,b); 文档中第 a 个字符前面插入字符串 b
阅读全文
摘要:1.头文件 #include<cstring> 2.功能 #include <iostream> #include<cstring> using namespace std; int main () { int m=100; string str=to_string(m); cout<<str[0]
阅读全文
摘要:1.头文件#include<cstring> 2.功能 #include <iostream> #include<cstring> using namespace std; int main () { string s="aaa"; cout<<s.find_first_not_of(s[0],1)
阅读全文
摘要:1.头文件 #include<cctype> 2.函数原型 int toupper(int c); 3.用法 #include<cstdio> #include<cctype> #include<iostream> using namespace std; int main(){ char a; c
阅读全文
摘要:1求上一个字典符顺序,顺序是从大到小 2.头文件#include<algorithm>
阅读全文
摘要:1.头文件 #include<algorithm> 2.作用 求两个数的最大公约数 3.注意语法 是两个下划线!!!
阅读全文
摘要:1.作用:去重,删除所有相邻位置的重复元素 2.使用之前先排序 sort() 3.头文件 #include<algorithm> 4.用法: int sum=unique(b,b+10)-b;
阅读全文
摘要:1.函数原型为: #include <algorithm> bool next_permutation(iterator start,iterator end) 2.用法 (1):需要将要数字按照升序排列 (2):使用方法: #include<cstdio> #include<iostream> #
阅读全文
摘要:1.头文件 #include<cstring> 2.用法 char s[100]; cin>>s; int n=strlen(s); 此时的n为串长
阅读全文
摘要:1.头文件 #include<cstring> 2.strcat()用法 strcar()可以将两个char类型连接。 char d[20]="GoldenGlobal"; char *s="View"; strcat(d,s); 结果放在d中 printf("%s",d); 输出 d 为 Gold
阅读全文
摘要:1.头文件#include<cstdio> 2.使用ssprintf(s,"%s",a); 这个语句可以将int 型的a以字符串的形式打印到s里面, 此时s变成字符串', 3.sscanf(s,"%d",&a); 这个语句就可以把s十进制的形式输入到a中了。 此时a就变成了12345678。
阅读全文
摘要:1.异或^ 数字逻辑课有讲过 相同为0 相异为1 0^0=0 ,1^1=0,0^1=0;(相同为1,相异为0) 0和任何数字抑或=任何数字
阅读全文
摘要:1.头文件:#include<array> 2.和数组有什么区别? 更安全,建议用其代替数组! 3.用法: array<int ,19>s 代表着 s[19] 并且里面的元素是int型 值得注意的是 array此时的数组并没有初始化 array 初始化的方法: (1) #include<iostre
阅读全文
摘要:1.auto 是根据初始定义的类型,然后自动匹配的占位符 2.如何使用? set<int>::iterator i; // for(auto i=q.begin();i!=q.end();i++) 关于i 的数据类型,按理说应该用iterator来写的 auto就能自动为它匹配一个类型,比较简便
阅读全文