(C++) Exercise \#7: AddOne
August 7, 2019 · View on GitHub
(C++) Exercise #7: AddOne
Difficulty: 2/10
Date added: 24th of June 2008
In this exercise, you learn that different ways to the same solution, yield different execution speeds.
Below is a declaration of a function to add one to every int in a std::vector:
void AddOne(std::vector<int>& v);
There are many ways to do this.
Question #0: How many correct ways are there to do this? Hint: more than 10.
Question #1: Write a program that tests which way is fastest
View the answer of this exercise.