Answer:
Following are the code to the given question:
#include <iostream>//header file
using namespace std;
int main() //main method
{
int n=0,a[1000],c=0,val=10,ma=0;//defining integer variable
cin>>val;//input value
while(val!=0)//defining while loop that checks val is not equal to 0
{
a[n++]=val;//add value in array
cout<<"Enter an integer (0: for end of input):";//print message
cin>>val;//input value
}
for(int i=0;i<n;i++)//loop for finding the maximum in the array.
{
ma=max(a[i],ma);//holding max value in ma variable
}
for(int i=0;i<n;i++)//loop for counting the occurence of maximum.
{
if(a[i]==ma)//use if to check maximum value in array
c++;//incrementing count value
}
cout<<"The maximum value is "<<ma<<" The count of maximum value is "<<c<<endl;//print result
return 0;
}
output:
Please find the attachment file.
Explanation:
In this code inside the main method, an integer variable is declared that input values and use while loop to check first input if the value is true it will accept value from the user and adds in the array.
In the next step, two for loop is declared that checks the max value and in the next loop it will count the number of maximum value which is occurring.