If you use a container like Vector, you can directly use its size() method to know the size. If it is an ordinary array, either initialize it to a value that cannot appear in normal data, or add a counter when inputting , calculate the number of input elements
If you use a container like Vector, you can directly use its size() method to know the size. If it is an ordinary array, either initialize it to a value that cannot appear in normal data, or add a counter when inputting , calculate the number of input elements
Lost the code and run away
From a human perspective: enter a number, add one to the quantity
From a code/machine perspective: the quantity is a cnt record, enter a cnt++