How to find how many elements are entered in an array

how to find out the number of elements user entered in an array of size 100 for example?

Use counter to keep track of the elements you have processed till now.
In the last print the counter.

  1. Using STL
vector<int> arr;
for(int i = 0,a; i < n; ++i){
     printf("ELEMENTS ENTERED: %d\n",(int)arr.size());
  1. Using another variable
int arr[100], included = 0;
for(int i = 0; i < n; ++i,++included){
     printf("ELEMENTS ENTERED: %d\n",included);