how using vectors?

i'm trying using an int vector:
1
2
3
4
5
6
7
vector<int> vecPriority;
int OperatorCount=0;
if(chr[0]=='*')
                {
                    vecPriority.push_back(OperatorCount);
                    cout << "prioity: " <<vecPriority[OperatorCount];
                }

the vecPriority don't recive a correct number... why these happens?
i recive a random big numbers values :(
Last edited on
If you want to access the last element in the vector you can use vecPriority.back().
thank you so much for all.
i fixed that and more on code. thank you
Topic archived. No new replies allowed.