for( int i = 0; i < numwithdraws; i++){
last10withdraws[i+1] = last10withdraws[i];
}
last10withdraws[0] = amount;
numwithdraws++;
}
I declared numwithdraws and last10withdraws[10] array in a parent class.
and I'm trying to test this loop so that I can shift the value of the elements
to the right by 1 each time I go through this function. Because I need to display the last 10 withdraws later on in another function:
void CreditCard::disp(){
for(int c = 0; c < 9; c++){
cout << "you input: " << last10charges[c] << endl;
}
}
}
so this is my main, testing the function, but the function DoCharge doesn't work x.x
I hope you guys could understand my question.
I'm thinking it's the numwithdraws variable since i did not initialize it. But I don't know how to initialize it so that it would only be = 0 once. I know it will always initialize numwithdraws = 0 each time i access the function.