Hi everybody I'm kind of new to C++ and I dont quite get this.
So I have a code wich sums the values from an array and the it outputs the result
1 2 3 4 5 6 7 8
|
while(i < 10)
{
sum += valor[i];
i++;
}
cout << sum << endl;
|
So is this the only way to achieve I mean only by using
+=
operator?
Last edited on
Just in case you don't realise, sum += valor[i];
is the same as sum = sum + valor[i];
.
You can make a class,....wait,...it might just more complicated...