c++ for each
#include <iostream>
#include <vector>
#include <list>
using namespace std;
int main()
{
vector<int> a;
for (int k=0;k<10;k++)
{
a.push_back(k);
}
list<char> b;
for (char c='a';c<'k';++c)
{
b.push_back(c);
}
//STL算法
for each (int a1 in a)
{
cout << a1<< " ";
}
cout << endl;
cout << "--------------------------------------------"<< endl;
for each(char b1 in b)
{
cout << b1 << " ";
}
cout << endl;
system("pause");
return 0;
}
---------------------------------------------
0 1 2 3 4 5 6 7 8 9
--------------------------------------------
a b c d e f g h i j
请按任意键继续. . .
随机推荐
- hadoop相关随记
1.用来查询集群上启动的job,并杀掉DumpTrack状态的job: yarn application -list|grep DumpTrack|awk '{print $1}' | xargs y ...
- VUE目录
学前预备知识 ECMAScript简介和ES6的新增语法 Nodejs基础 webpack的介绍 babel简介 vue基础 vue基础
- python_面向对象——类之间的依赖关系
class Dog: def __init__(self,name,age,master): self.name = name self.age = age self.master = master ...
- mysql数据库NOW()和DATE_FORMAT()日期字段和当前日期作比较
select * from xxxx where date_format(APPOINTMENT,'%Y-%m-%d-%H-%i-%S') < date_format(now(),'%Y-%m- ...
- MySQL分组排序(取第一或最后)
MySQL分组排序(取第一或最后) 方法一:速度非常慢,跑了30分钟 SELECT custid, apply_date, rejectrule FROM ( SELECT *, IF ( , ) A ...
- Codeforces Round #583 (Div. 1 + Div. 2, based on Olympiad of Metropolises) C题
C. Bad Sequence Problem Description: Petya's friends made him a birthday present — a bracket sequenc ...
- HTML的列表,表格与媒体元素
一.无序列表 <ul> <li>无序列表</li> &l ...
- java+web+多级文件上传
文件夹数据库处理逻辑 publicclass DbFolder { JSONObject root; public DbFolder() { this.root = new JSONObject(); ...
- leetcode解题报告(5):Longest Consecutive Sequence
描述 Given an unsorted array of integers, find the length of the longest consecutive elements sequence ...
- CF917D Stranger Trees【矩阵树定理,高斯消元】
题目链接:洛谷 题目大意:给定一个$n$个节点的树$T$,令$ans_k=\sum_{T'}[|T\cap T'|=k]$,即有$k$条边重合.输出$ans_0,ans_1,\ldots,ans_{n ...