constint MAXSIZE =100;
/* Function Prototypes */
void readdata(int [], int);
int countzeros(int[], int);
void append(int [], int);
int main()
{
int number[MAXSIZE];
int a, n;
cout<<"Enter the number of elements in the array: "<<endl;
readdata(number, n);
cout << "Enter a number into the array: ";
readdata(number, n);
cout << endl << "Original Data" << endl;
append(number,n);
cout<< "The amount of zeroes in this array are: "<<endl;
countzeros(number, a);
return 0;
}
/* Function to print an array */
void append(int vals[], int n)
{
for (int i = 0; i < n; i++)
cout << vals[i] << endl;
return;
}
void readdata(int vals[], int n)
{
cin>>n;
for(int i=0; i<n; i++)
{
cin>>vals[i];
cout<<vals[i]<<endl;
}
return ;
}
int countzeros(int vals[], int n)
{
int count=0;
for (int position = 0; position < n; position++)
if (vals[position] == 0)
count++;
return count;
}
I did it. But it doesn't show how many zeroes are in the array in fact, it just says "The amount of zeroes in this array are: " and that's it. I want to be able to show the amount of zeroes that I put in the array.