All you have to do is follow these steps:
1) Create an array to store your extracted numbers and initialize all numbers to
-1( you will see why later ).
2) Open the file that contains the numbers.
3) Create a for loop that suits your needs.
4) In the loop, extract each number, whilst placing the extracted number into the next slot in the array.
5) When the loop has finished, enter another loop.
6) With the new loop, count how many elements in the array that have the value of
-1.
If your file contains negative numbers as well as positive numbers, you could create a small structure like this:
1 2 3 4 5 6 7
|
struct Number
{
int Value;
bool Used; // This is only true if "Value" is holding an extracted value.
};
Number Numbers[ 100 ] = { 0, false };
|
Using the above code segment will mean your array can hold any positive or negative value.
There are probably other ways, but you could try this to see if it works for you.