Okay thanks I will try other methods to improve the performance an easy fix that I can think of would be to just add to the end then reverse it for the final answer would that be better or should I look for a better performance method?
*edit also I don't like how my for loop looks I am going to fix that so it isn't so rubbish.
I know it is possible to do it, but it is nonsensical to ASSIGN VALUE to (a+b), and any compiler worth it's salt ought to tell you you are probably doing something wrong. Why? Because (a+b) is not a proper lvalue.
(Now, I know you can shuffle the shells enough to make (a+b) into some grotesque version of an lvalue, but whatever you do to it will be non-obvious, because it breaks design pattern and KISS.)
In contrast, (a+b) is a perfectly normal rvalue, and there is nothing wrong with applying operations to it.
By definition, whenever you have an EQUALS SIGN, you are playing with an lvalue on the left, and an rvalue on the right.
(And again, I don't care if you can twist C++ syntax into something that invalidates this statement. I can do it too, but I won't, because it would be WRONG.)
So, you want to take two separate statements of mine, mix them, and claim that the false conclusion is my words? That's a straw man.