![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
蓝桥杯2019学习备战
Faracall
踽踽独行 忠于独特
展开
-
2013-1-1高斯日记
题目略今天重点是复习闰年的算法,以及新东西。1.笨拙法#include<iostream>#include<cmath>using namespace std;int main(){ int yr; cin>&原创 2019-02-27 23:01:18 · 163 阅读 · 0 评论 -
C++中STL用法总结
详见:https://blog.csdn.net/piaoxuezhong/article/details/54348787原创 2019-03-17 20:26:49 · 172 阅读 · 0 评论 -
new int(),new int[]和int *a=new int(),int *a=new int[]
new int[]创建一个int型数组,数组大小是在[]中指定,例如:int * p = new int[3];//申请一个动态整型数组,数组的长度为[]中的值new int()创建一个int型数,并且用()括号中的数据进行初始化例如:int *p = new int(10);// p指向一个值为10的int数。1 int *a=new int(120);申请一个整型变量空间...原创 2019-03-17 16:56:36 · 29080 阅读 · 3 评论 -
void swap(int &a,int &b) 为什么要加&符号
参数里面的&表示引用型参数一般的参数传递的时候,形参是实参的副本,也就是说,形参虽然和实参一样,但是在内存中的位置不同而引用型参数,在函数参数传递的时候,并不要复制参数,形参和实参在内存中是同一个位置,因此修改形参,实参也变化了& 这里表示引用,说明需要传递变量给这个函数,函数中可以对参数的值进行修改如果没有 &,修改的就是函数体中的临时变量...原创 2019-03-17 16:40:40 · 6319 阅读 · 6 评论 -
C++STL中全排列函数next_permutation&手动计算全排列递归方法
next_permutation函数函数原型:#include <algorithm>bool next_permutation(iterator start,iterator end)//当当前序列不存在下一个排列时,函数返回false,否则返回true。函数介绍:next_permutation(start,end):求的是当前排列的下一个排列prev_permuta...原创 2019-03-17 16:31:23 · 345 阅读 · 0 评论 -
countof,sizeof,strlen(),size(),length()的区别学习&& 字符串中’/0’的问题
字符串中’/0’的问题C++中没有字符串对象,字符串可以看成是字符数组。字符串和数组的区别:在最后的一个元素"\0"上,它标志着一串字符是否是字符串。(在内存中,就是根据"\0"来确认字符串,如果找不到就会沿着字符一直找下去。它原创 2019-03-17 11:48:53 · 886 阅读 · 0 评论 -
查询c++API以及printf%*的s知识点
http://www.cplusplus.com/reference/ c++查询api地址printf (“Width trick: %*d \n”, 5, 10);这里的*指的是宽度原创 2019-03-17 10:58:31 · 200 阅读 · 0 评论 -
string 类型中find函数用法和string::npos的含义
string::npos参数—— npos 是一个常数,用来表示不存在的位置find()函数string中find()返回值是字母在母串中的位置(下标记录),如果没有找到,那么会返回一个特别的标记npos。(返回值可以看成是一个int型的数)用法:str.find(“字符串”) 返回值是字符在母串s中的下标位置;str.find(“字符串”,num) 从s的下标num开始,查找...原创 2019-03-16 19:43:26 · 1153 阅读 · 0 评论 -
i2s和s2i算法——sstream用法
stringstream头文件:#include <sstream>1.1 int to stringstring str;stringstream ss;int num;cin>>num;ss<<num;ss>>str;cout<<str&原创 2019-03-16 19:23:00 · 757 阅读 · 0 评论 -
substr,insert, erase,append,replace——string中函数操作
一. string 常用函数字符串处理:1.substr操作:注意substr没有迭代器作为参数的操作#include <bits/stdc++.h>using namespace std;int main(){ ios::sync_with_stdio(false); string s="abcdefg"; //s.substr(pos1,n)...原创 2019-03-02 19:50:34 · 709 阅读 · 1 评论 -
递归
递归的特点:先纵后横原创 2019-03-17 20:35:03 · 141 阅读 · 0 评论