summing the values of 2 vectors.
Solved
C++ Gurus
-
hello,
how do you sum the values of 2 vectors.
for example:// example A 3 1 // vector A 5 2 8 // vector B
or
example B 5 2 8 // vector A 3 1 // vector B
in the case of example A
3 + 5 =
3 + 2 =
3 + 8 =
1 + 5 =
1 + 2 =
1 + 8 =in the case of example B
5 + 3
5 + 1
2 + 3
2 + 1
8 + 3
8 + 1what kind of looping mechanism would it take?
-
@Natural_Bugger
Outerfor
loop on vector A, innerfor
loop on vector B, for the order you specify. Resulting in 6 answers in each example.