Answer:
See explaination
Step-by-step explanation:
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <iomanip>
using namespace std;
int main()
{
map<int, int> histogram;
int a=0;
while(a>=0)
{
cout << " enter value of a" ;
cin >>a;
histogram[a]++;
}
map<int,int>::iterator it;
for ( it=histogram.begin() ; it != histogram.end(); it++ )
{
cout << (*it).first << " occurs " << setw(3) << (*it).second << (((*it).second == 1) ? " time." : " times.") <<endl;
}
return 0;
}