- 新增现代 C++ 教程的 Preface 章节,包括英文和中文版本 - 添加 C++ Primer 练习代码 - 新增 Learn C++ 教程的 C++ 开发简介章节 - 添加头文件解析文档 - 更新 mkdocs.yml,包含新教程的目录结构 - 修改项目设置,使用 Python 3.10环境
27 lines
594 B
C++
27 lines
594 B
C++
#include <iostream>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
using namespace std;
|
|
using std::vector;
|
|
|
|
int main() {
|
|
|
|
vector<int> words;
|
|
for (int i = 0; i < 10; i++) {
|
|
words.push_back(rand() % 1000);
|
|
}
|
|
cout << "随机生成的数字是:" <<endl;
|
|
for(auto it = words.begin(); it != words.end() && !words.empty(); it++) {
|
|
cout << *it << " ";
|
|
}
|
|
cout <<endl;
|
|
|
|
cout << "翻倍后的数字是:" <<endl;
|
|
|
|
for(auto it = words.begin(); it != words.end() && !words.empty(); it++) {
|
|
*it = *it * 2;
|
|
cout << *it << " ";
|
|
}
|
|
return 0;
|
|
} |