55
edits
Changes
→Introduction: The Standard Template Library
}
</code></pre>
Output:
<pre>
== FOR EACH ==
Element: 10
Element: 9
Element: 8
Element: 7
Element: 6
Element: 5
Element: 4
Element: 3
Element: 2
Element: 1
== COUNTING NUMBERS LARGER THAN 6 ==
There are 4 numbers larger than 6 in the vector
== FINDING AN ELEMENT ==
The element 6 is the first that satisfies i > 4 && i % 6 == 0
</pre>
These algorithms not only make the code easier to write and read, but it also tends to be faster: these algorithms are heavily optimized, making them much faster than for/while loops.