Hi, I'm new here and new at c++ but I hope someone has time to help.
I'm trying to get two values from specific places in a vector, based on a position in another vector and assigning those values to ints. Then I'd like to replace the two values (a and b) with the result (c) and 0, but I can't find a way that doesn't involve iterators... And getting the values from a vector based on some values in another vector seems impossible using an iterator :(
I'm not so sure about the pointers either, but they shouldn't be causing the problem?
My main problems are; the ">>" doesn't make "a" equal to the value at "numbers.at(i)" and finding a way to replace values. I've tried using "numbers[i] = a" instead of at() but I didn't get it to work.
Any help is appreciated, thanks!
1 2 3 4 5 6 7 8 9 10 11 12
void Multiply::count() {
int i;
for (i = 0; i < signs.size(); i++) {
if (signs.at(i) == '*') {
numbers.at(i) >> a;
numbers.at(i+1) >> b;
c = *a * *b;
// numbers.insert(iterator, c); <- probably wrong, but you see what I want to do
// numbers.insert(iterator.next(),0);
}
}