Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
Math code snippet to square all elements in a container (that is: to multiply each element with itself).
There are multiple ways to implement MakeSquare:
This is the anwer of exercise #9: No for-loops #14.
#include <algorithm> |
Prefer algorithms over loops [1][2].
#include <vector> |
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.