| iterators/it-1-range-for.cc - Equivalent program with range-for - with iterators abstracted away - C++11. | Lecture 6 - slide 3 : 40 Program 2 |
// No iterators at all - range-for instead (C++11).
#include <iostream>
#include <string>
#include <vector>
int main(){
using namespace std;
vector<double> vd;
for(int i = 1; i <= 10; i++)
vd.push_back(i + i/10.0);
for(auto el: vd){
cout << el << " "; // 1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 11
}
}