Lecture 7: Vectors PDF
Document Details
Uploaded by FervidDune
ETH Zurich
Tags
Summary
This document appears to be lecture notes on vectors in C++. It covers various aspects of vectors, including their types, the use of the Sieve of Erathostenes, memory layout, iteration, and nested vectors. The provided snippet also includes example C++ code.
Full Transcript
11. Vectors Vector Types, Sieve of Erathostenes, Memory Layout, Iteration, Nested Vectors (Vectors of Vectors) 312 Vectors: Motivation Now we can iterate over numbers for (int i=0; i n; // definition and initializatio...
11. Vectors Vector Types, Sieve of Erathostenes, Memory Layout, Iteration, Nested Vectors (Vectors of Vectors) 312 Vectors: Motivation Now we can iterate over numbers for (int i=0; i n; // definition and initialization: provides us with Booleans // crossed_out,..., crossed_out[n-1], initialized to false std::vector crossed_out = std::vector(n, false); // computation and output std::cout