随笔分类 - c++函数
C++ 输入输出 字符串 技巧
摘要:———————————————— 版权声明:本文为CSDN博主「zombo_tany」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/qq_46640863/article/details/126705009
C++ 突袭
摘要:参考视频1:https://www.bilibili.com/video/BV1ZT4y1C7WR/?p=24&spm_id_from=333.788.top_right_bar_window_history.content.click 参考视频2:https://www.bilibili.com/
【C++ STL】 Set和Multiset
摘要:概念 相同点: set和multiset会根据特定的排序原则将元素排序。 插入一个数,删除一个数都能够在O(logn)的时间内完成。 两者不同之处在于 multisets允许元素重复,而set不允许重复。 常用操作 变动性操作 c.insert(elem) 插入一个elem副本,返回新元素位置,无论
error: 'gets' was not declared in this scope; did you mean 'fgets'? 解决方法
摘要:问题原因 gets()已经不被提交平台的C++编译器支持, 解决方法 方法1:改用c语言 但是C语音编译器未受影响,把头文件改成C语言格式,用C语音编译器即可通过。 方法2:改用cin.getline /* 读入一行(可含空格),直到换行符结束 * 将其前num-1个字符存入数组a中并以字符c结尾
C++ map按key或按value排序
摘要:map按key排序 (1)map默认按照 key 从小到大排序 map<string,int> hash; //等价于 map<string,int, less<string>> hash; (2)map按照 key 从大到小排序 map<string,int, greater<string> >
vector用法
摘要:C++中的一种数据结构,确切的说是一个类.它相当于一个动态的数组。 vector基本用法: #include<vector>//头文件 using namespace std;//命名空间 vector<int> Vec;//函数调用 int a; cin>>a; Vec.push_back(a);
c++速成笔记
摘要:可变数组 #include <iostream>//读写 #include <vector> using namespace std; int main() {//可变数组 vector <int> vNums(2);//关键1 vNums[0]=11; vNums[1]=2; vNums.push
数据结构 栈and队列
摘要:栈 基本特点 后进先出(Last In First Out) 只在栈顶进行插入和删除等操作 栈的基本数据结构(顺序栈) struct stack { int *base;//尾指针,指向栈底 int *top;//头指针,一般指向栈顶上一个元素 int stacksize;//栈的最大容量 }; 制
全排列函数next_permutation 用法
摘要:原文:链接 函数原型: #include <algorithm> bool next_permutation(iterator start,iterator end) ####返回值: 当 当前序列不存在下一个排列时,函数返回false,否则返回true 执行操作: next_permutation