Fix given functions.
- Lucas Leandro Costa Lacerda
- iostream
- In the first line remove
.h
suffix. - Swap function:
- Add
&
operator in the parameters to change by reference.
- Add
- Selection Sort function:
- Remove
const
from the array because change the values. - Change
++i
toi++
. - Remove
min_index
from thefor
because it will not change inside the execute condition. Also removed from receive thej
parameter because themin_index
has to be the first value. - Change
j
variable tovalidate_min_index
. - Indent the code to
swap
be inside ofif
scope. - Pass the array value instead the position in
swap
function.
- Remove
- Print Array function:
- Remove
&
operator because will not be changed. - Change ',' to ';' inside the for.
- Change how the array iterate.
- Add
std::
before using output methods.
- Remove
- Main:
- Pass the array size as parameter instead the value.
Released under the MIT license.