⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 10_33.cpp

📁 10个比较经典的C++程序。初学者就先多学习学习别人吧。
💻 CPP
字号:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{	int Array[9]={25,7,9,2,0,5,21,15,13};
	vector<int> iVector(Array,Array+9);
	//使用通用算法nth_element将第N个最小元素放置在v.begin() + N
	nth_element(iVector.begin(),iVector.begin() + 3, iVector.end());
	cout << "After nth_element:  ";
	copy(iVector.begin(), iVector.end(), ostream_iterator<int> (cout, " "));
	//使用通用算法random_shuffle混排元素
	random_shuffle(iVector.begin(),iVector.end());
	cout << "\nAfter random_shuffle:  ";
	copy(iVector.begin(), iVector.end(), ostream_iterator<int> (cout, " "));
	return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -