My question is that our professor doesn't allow us to use vectors. So in a case where I don't know how many times user is going to enter something how do I implement that using normal arrays in c++
I am trying to do this with normal arrays
vector<int> x;
x.push_back(users_input);
user_input could be an integer user enters then I should also be able to find it's size
int size = end(x) - begin(x);
MY requirement is that I want to add values to this array only when program falls into that switch choice which means I am not sure how many times user decides to come into that switch choice.
I can make an array and initialize it much largely.
int arr[1000];
But then how do I find the number of elements in it because if I use sizeof it will give me '1000' not the amount of elements that have gotten stored?
Any help? Thank you!
Aucun commentaire:
Enregistrer un commentaire