![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++学习之路
文章平均质量分 71
小梁先生
这个作者很懒,什么都没留下…
展开
-
C++学习之路(一)
函数重载,函数模版直接上代码:#include #include#includeusing namespace std;//函数模版template //定义通用模版类型名为T;T max(T a, T b){ if (a > b) return a; else return b;}int main(){ int a, b; a = 2, b = 3;原创 2013-11-20 21:03:38 · 801 阅读 · 0 评论 -
C++学习之路 STL中栈,队列,优先队列
STL 栈 stack头文件: #include声明方式: stack栈名(xxx);主要操作:1.xxx.push(元素) 将于素压入栈2.xxx.top() 取出栈顶元素,(不从栈中删除)3.xxx.pop() 将栈顶元素删除4.xxx.size() 返回栈中元素个数5.xxx.empty()原创 2014-02-28 08:54:59 · 788 阅读 · 0 评论 -
集合运算 蓝桥杯
问题描述 给出两个整数集合A、B,求出他们的交集、并集以及B在A中的余集。输入格式 第一行为一个整数n,表示集合A中的元素个数。 第二行有n个互不相同的用空格隔开的整数,表示集合A中的元素。 第三行为一个整数m,表示集合B中的元素个数。 第四行有m个互不相同的用空格隔开的整数,表示集合B中的元素。 集合中的所有元素均为int范围内的整数,n、m原创 2014-03-18 20:09:19 · 1571 阅读 · 0 评论 -
sort 及 priority_queu 中struct结构体的重载<排序
关于sort,priority_queue 的struct中自定义的排序方法会产生不同的序列看例子:#include#include#includeusing namespace std;struct Demo{ int x, y; bool operator<(const Demo &A)const{ return x < A.x; }};vectorD;prio原创 2014-04-01 20:23:38 · 1073 阅读 · 0 评论 -
C++ 按字符读取字符串
#include #include using namespace std;int main(int argc, const char * argv[]){ // insert code here... // std::cout << "Hello, World!\n"; char ch; cout<<"Enter characters; enter # to q原创 2014-04-08 00:09:28 · 1699 阅读 · 0 评论 -
C++ array类作为函数参数传递
#include#include#include#includeusing namespace std;const int Season = 4; //四个季节const arraySname = { "Spring", "Summer", "Fall","Winter" };//存储四个string的Sname数组void fill(array *pa);void Show(a原创 2014-04-09 18:07:37 · 4052 阅读 · 0 评论