的for循环
#include <iostream>using namespace std;
int main()
{
int a[]{1, 3, 5, 7, 9};
for (auto tmp : a)
cout << tmp << endl;
}
问一下在for循环中如何控制他的步长,遍历的起始位置跟终止位置呢?谢谢大家了 用for(i;i<length;i++)方式遍历 增强for循环只能用于遍历数组或其他容器,要是想控制步长或别的什么控制,还是用原始的for( ; ; )比较好点
页:
[1]