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
请按任意键继续. . .
随机推荐
- Visual studio 2010 打开高版本VS工程解决办法
第一步.找到工程项目文件: 第二步.编辑项目文件 找到Format Version 12.00 ,将数字改为11.00 再找到#Visual Studio 14 将数字改为2010 点击保存并关闭 第 ...
- Selenium(十一)使用EXCEL读取用户数据和生成测试报表
1.下载两个模块 2.xlrd的使用方法 3.使用excel获取数据 在userdata文件中增加代码: login.py: 4.使用excel生成测试报表 举例: 在log_module中定义函数: ...
- WCF双通信
请求过程中的回调 这是一种比较典型的双工消息交换模式的表现形式,客户端在进行服务调用的时候,附加上一个回调对象:服务在对处理该处理中,通过客户端附加的回调对象(实际上是调用回调服务的代理对象)回调客户 ...
- oracle 给表字段把VARCHAR2 换成 CLOB
select * from TableName -- 添加一个字段 alter table TableName add 字段2 clob; --复制数据到此字段update TableName set ...
- 删除集合元素Collection ,remove()
package seday11;/*** @author xingsir*/public class coordinate { private int x; private int y; /* * 右 ...
- Codeforces Round #596 (Div. 2, based on Technocup 2020 Elimination Round 2) B2. TV Subscriptions (Hard Version)
链接: https://codeforces.com/contest/1247/problem/B2 题意: The only difference between easy and hard ver ...
- SqlBulkCopy插入时:来自数据源的 String 类型的给定值不能转换为指定目标列的类型 int。 ---> System.FormatException: 将参数值从 String 转换到 Int32 失败。 ---> System.FormatException: 输入字符串的格式不正确。
偶尔间看到的 记录下:https://bbs.csdn.net/topics/390430064
- 安裝開源BBS軟件YAF時碰到的問題
1.下載 http://yetanotherforum.net/download.aspx 安裝說明 http://www.drreddys.com/quest/readme.htm 其實只要打開根目 ...
- .net常用属性
1. 在ASP.NET中专用属性: 获取服务器电脑名:Page.Server.ManchineName 获取用户信息:Page.User ...
- 1.1 OC class new summary
1.http://www.cnblogs.com/mjios/archive/2013/04/06/3002814.html 2.How to create a oc class? 3. 3.1 In ...