当前位置: 首页 > news >正文

钓鱼网站图片代推广app下载

钓鱼网站图片,代推广app下载,做网站设计网站建设推广,禅城区城乡建设局网站目录 1.next_permutation函数的定义 2.简单使用 2.1普通数组全排列 2.2结构体全排列 2.3string 3.补充 1.next_permutation函数的定义 next_permutation函数会按照字母表顺序生成给定序列的下一个较大的排列,直到整个序列为降序为止。与其相对的还有一个函数—…

目录

1.next_permutation函数的定义

2.简单使用

2.1普通数组全排列

 2.2结构体全排列

2.3string

3.补充


1.next_permutation函数的定义

next_permutation函数会按照字母表顺序生成给定序列的下一个较大的排列,直到整个序列为降序为止。与其相对的还有一个函数——prev_permutation函数。

next_permutaion(起始地址,末尾地址+1)
next_permutaion(起始地址,末尾地址+1,自定义排序)

注:next_permutation只能获得上一个排列,如果要获得全排列,那么就需要先对数组进行升序排序

2.简单使用

2.1普通数组全排列

#define _CRT_SECURE_NO_WARNINGS 1#include <iostream>
#include <algorithm>
using namespace std;int main()
{int arr[4] = { 1, 2, 3, 4 };do {for (int i = 0; i < 4; i++){cout << arr[i] << " ";}cout << endl;} while (next_permutation(arr, arr + 4));return 0;
}

 运行结果:

1 2 3 4
1 2 4 3
1 3 2 4
1 3 4 2
1 4 2 3
1 4 3 2
2 1 3 4
2 1 4 3
2 3 1 4
2 3 4 1
2 4 1 3
2 4 3 1
3 1 2 4
3 1 4 2
3 2 1 4
3 2 4 1
3 4 1 2
3 4 2 1
4 1 2 3
4 1 3 2
4 2 1 3
4 2 3 1
4 3 1 2
4 3 2 1

 2.2结构体全排列

由于结构体默认不能比较大小,所以就不能使用默认的next_permutation()排列比较函数,需要使用自定义排列比较函数。

#define _CRT_SECURE_NO_WARNINGS 1#include <iostream>
#include <algorithm>
using namespace std;typedef struct
{int test;bool operator < (const fyd& a){return test < a.test;}}fyd;fyd arr[4];int main()
{arr[0].test = 2;arr[1].test = 1;arr[2].test = 4;arr[3].test = 3;do {for (int i = 0; i < 4; i++){cout << arr[i].test << " ";}cout << endl;} while (next_permutation(arr, arr + 4));return 0;
}

运行结果:

1 2 3 4
1 2 4 3
1 3 2 4
1 3 4 2
1 4 2 3
1 4 3 2
2 1 3 4
2 1 4 3
2 3 1 4
2 3 4 1
2 4 1 3
2 4 3 1
3 1 2 4
3 1 4 2
3 2 1 4
3 2 4 1
3 4 1 2
3 4 2 1
4 1 2 3
4 1 3 2
4 2 1 3
4 2 3 1
4 3 1 2
4 3 2 1

2.3string

string等数据结构不能直接用名字代表地址,只能够使用自带的迭代器begin()、end()实现全排列。

#define _CRT_SECURE_NO_WARNINGS 1#include <iostream>
#include <algorithm>
using namespace std;int main()
{string s;cin >> s;do{cout << s << endl;}while (next_permutation(s.begin(), s.end()));return 0;
}

运行结果:

abc //inputabc
acb
bac
bca
cab
cba

3.补充

推荐大家使用:cplusplus.com - The C++ Resources Network

可以查询到对应函数对应的头文件、底层代码及使用方式等。

例如:

 剩下的就不多说啦!自己探索叭!

http://www.hkea.cn/news/991517/

相关文章:

  • 网络营销网站建设实训网络营销步骤
  • 网站都有后台吗百度竞价开户公司
  • 秭归网站建设网站seo优化心得
  • wordpress电影网站模板seo运营
  • 公司注册网上核名业务如何终止网站排名优化怎么做
  • 网站建设伍金手指下拉2网上推广平台
  • 沧州网站建设公司翼马爱情链接
  • 计算机学了出来干嘛免费优化推广网站的软件
  • 宁波网站建设优化湖南seo优化按天付费
  • 门户网站手机版google官网入口
  • 深圳市工程建设交易服务中心网站软文什么意思
  • 大型网架加工厂成都网站建设方案优化
  • 导航网站的广告怎么做的千锋教育官方网
  • etc网站开发票网站制作软件免费下载
  • 上海seo网站设计2022十大网络营销案例
  • 还有做网站的必要吗网站运营推广方案
  • 企业营销型网站建设厂家品牌搜索引擎服务优化
  • 学校网站建设计划怎么成为百度推广代理商
  • 普陀网站开发培训学校seo快速优化
  • 建一个商城网站多少钱免费的网站推广软件
  • 手机网站解决方案看网站搜什么关键词
  • 顺企网江西网站建设宜昌今日头条新闻
  • 坪山网站建设行业现状网页设计与制作代码成品
  • 网站建设需求文档模板下载学大教育一对一收费价格表
  • 小型网站怎样优化百度首页官网
  • 网站开发与iso9001关系百度上做推广怎么做
  • wordpress怎么设置导航镇江seo
  • 番禺建设网站服务软文写作网站
  • 有哪些专做自然风景图片的网站石首seo排名
  • 移动网站虚拟主机seo 排名 优化