C++语言之“基于范围的for循环”

发现C++11引入的一种跟python类似的for循环——基于范围的for循环

#include<iostream>
#include<string>

using namespace std;

int main()
{
int someNums[] = {1,101,-1,40,1024};

for(const int& aNum : someNums)
	cout << aNum << " ";
cout << endl;
return 0;

}

猜你喜欢

转载自blog.csdn.net/m0_37811192/article/details/81045246
今日推荐