会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
念秋
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
8
9
10
11
12
13
下一页
2020年1月
char数组和string的相互转换
摘要: 1 //char数组和string的转换 2 #include<iostream> 3 #include<string.h> 4 using namespace std; 5 int main() 6 { 7 char ch[]="hello world"; 8 // string s=ch;/*
阅读全文
posted @ 2020-01-12 09:58 念秋
阅读(5799)
评论(0)
推荐(0)
2019年12月
归并排序的递归和迭代写法
摘要: 1 #include<iostream> 2 using namespace std; 3 int n; 4 void print(int *a) 5 { 6 for(int i=0;i<n;i++) 7 { 8 cout<<a[i]<<" "; 9 } 10 cout<<endl; 11 } 12
阅读全文
posted @ 2019-12-19 10:02 念秋
阅读(544)
评论(0)
推荐(0)
map中左边为指针时引发的思考
摘要: map左边只有结构体指针时,地址分配由创建顺序由大到小,map左边排序按照指针地址数值大小由大到小进行排序,不同于平时的由小到大。 1 #include<iostream> 2 #include<map> 3 using namespace std; 4 typedef struct tree* T
阅读全文
posted @ 2019-12-17 15:28 念秋
阅读(406)
评论(0)
推荐(0)
用auto和iterator迭代器对元素赋值比较
摘要: /* auto赋值只是暂时有效,iterator赋值才是真实有效地*/ /* 不只是vector,所有能用迭代器的容器应该都具有这个特点*/ 1 #include<iostream> 2 #include<vector> 3 using namespace std; 4 int main() 5 {
阅读全文
posted @ 2019-12-14 10:23 念秋
阅读(1158)
评论(2)
推荐(1)
2019年11月
c++数组初始化赋值
摘要: 纸上得来终觉浅,绝知此事要躬行。 1 #include<iostream> 2 #include<string.h> 3 #include<algorithm> 4 using namespace std; 5 int main() 6 { 7 int a[5]; 8 memset(a,257,20
阅读全文
posted @ 2019-11-28 13:16 念秋
阅读(6930)
评论(0)
推荐(0)
c++重载部分运算符以及输入输出运算符
摘要: 1 #include<iostream> 2 using namespace std; 3 struct tree{ 4 int num; 5 string s; 6 bool operator<(const tree &a)const 7 { 8 return a.num<num; 9 } 10
阅读全文
posted @ 2019-11-27 08:28 念秋
阅读(393)
评论(0)
推荐(0)
priority_queue里面自定义类型的使用。
摘要: 1 #include<iostream> 2 #include<queue> 3 using namespace std; 4 struct tree{ 5 int num; 6 string s; 7 tree(int x,string zfc) 8 { 9 num=x; 10 s=zfc; 11
阅读全文
posted @ 2019-11-27 00:03 念秋
阅读(1113)
评论(0)
推荐(0)
自定义数据类型使用sort排序
摘要: 1 #include<iostream> 2 #include<algorithm> 3 using namespace std; 4 struct tree{ 5 string zfc; 6 int a; 7 /*bool operator<(const tree &a) 8 { 9 if(zfc
阅读全文
posted @ 2019-11-26 23:02 念秋
阅读(798)
评论(0)
推荐(0)
map的赋值,交换以及初始化
摘要: 1 #include<iostream> 2 #include<map> 3 using namespace std; 4 struct dian{ 5 int x,y; 6 /*bool operator<(const dian &a) const 7 { 8 return a.x>x; 9 }*
阅读全文
posted @ 2019-11-26 22:29 念秋
阅读(3691)
评论(0)
推荐(0)
set的交换,赋值以及初始化
摘要: 1 #include<iostream> 2 #include<set> 3 using namespace std; 4 struct dian{ 5 int x,y; 6 /*bool operator<(const dian &a) const 7 { 8 return x<a.x; 9 }*
阅读全文
posted @ 2019-11-26 22:27 念秋
阅读(1502)
评论(0)
推荐(0)
上一页
1
···
8
9
10
11
12
13
下一页
公告