代码:
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char *argv[])
{
vector<int> a = {0, 2, 5, 9, 10, 33, 22, 12};
for(auto x: a) cout<<x<<" ";
cout<<endl;
for(auto x:{133, 111, 333, 222, 555, 123, 89})
cout<<x<<" ";
cout<<endl;
return 0;
}
编译:g++ -std=c++0x main.cpp
运行:a.out
输出:
0 2 5 9 10 33 22 12
133 111 333 222 555 123 89