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

📄 10_24.cpp

📁 C++语言程序设计案例教程,郑莉编的书
💻 CPP
字号:
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{   vector<int> ivect(8); 
    fill(ivect.begin(), ivect.end(), 2);  // 使用通用算法fill
    cout<<"After filling ivect with 2's: "<<endl; 
    copy(ivect.begin(), ivect.end(), ostream_iterator<int> (cout, " ")); 
    fill_n(ivect.begin(), 3, 5);  		// 使用通用算法fill_n
    cout<<"\nAfter filling the first three elements with 5's: "<<endl;
    copy(ivect.begin(), ivect.end(), ostream_iterator<int> (cout, " ")); 
    return 0;
}

⌨️ 快捷键说明

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