发现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;
}
发现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;
}