摘要: 1.头文件: #include<cstring> 2.使用方法s.substr(1,4) 3.功能 复制字符串s中 从第1位开始的长度为4的字符串(默认时的长度为从开始位置到尾) 参考:https://blog.csdn.net/no_retreats/article/details/7853066 阅读全文
posted @ 2020-03-30 23:40 miao-xixixi 阅读(485) 评论(0) 推荐(0)
摘要: 1.两者头文件都是#include<cstring> 2.参数不同 atoi()的参数是 const char* , 因此对于一个字符串str我们必须调用 c_str()的方法把这个string转换成 const char*类型的, 而stoi()的参数是const string*,不需要转化为 c 阅读全文
posted @ 2020-03-30 23:34 miao-xixixi 阅读(773) 评论(0) 推荐(0)
摘要: 1.头文件#include<cmath> 2.使用方法 double round(double d); 阅读全文
posted @ 2020-03-30 17:17 miao-xixixi 阅读(2052) 评论(0) 推荐(0)
摘要: 1.头文件: #include<numeric> 2.功能:算出累加的和 3.使用方法: sum = accumulate(vec.begin() , vec.end() , c); 表示一个区间内所有的和 加上c这个初值的和 阅读全文
posted @ 2020-03-30 17:00 miao-xixixi 阅读(540) 评论(0) 推荐(0)
摘要: 头文件: 1.#include<algorithm> 2.功能:能找出最大值和最小值 3.使用方法: minmax_element(m1.begin(),m1.end()); cout << "min: " << *(m1.first) << endl; cout << "max: " << *(m 阅读全文
posted @ 2020-03-29 00:07 miao-xixixi 阅读(672) 评论(0) 推荐(0)
摘要: 题目如下: 代码如下: #include<cstdio> #include<iostream> #include<vector> #include<unordered_set> #include<cstring> using namespace std; int main(){ vector<int 阅读全文
posted @ 2020-03-26 23:47 miao-xixixi 阅读(125) 评论(0) 推荐(0)
摘要: #include<cstdio> #include<iostream> #include<cstring> using namespace std; main(){ string s; getline(cin,s); cout<<s; return 0; } 运行结果: 1.头文件:#include 阅读全文
posted @ 2020-03-26 23:11 miao-xixixi 阅读(1245) 评论(0) 推荐(0)
摘要: 题目: 参考日神的 链接如下:https://blog.csdn.net/richenyunqi/article/details/79491648 代码如下: #include<cstdio> #include<algorithm> #include<iostream> #include<vecto 阅读全文
posted @ 2020-03-26 00:10 miao-xixixi 阅读(90) 评论(0) 推荐(0)
摘要: 举例如下: #include<cstdio> #include<iostream> #include<unordered_set> using namespace std; main(){ unordered_set<int> us; us.insert(1); us.insert(2); us.i 阅读全文
posted @ 2020-03-25 23:54 miao-xixixi 阅读(5781) 评论(0) 推荐(0)
摘要: eg: vector<int> v={1,2,3,4}; for(auto i:v) cout<<i; 遍历v里面的每一个元素。 阅读全文
posted @ 2020-03-25 23:20 miao-xixixi 阅读(913) 评论(0) 推荐(0)