My program should allow the user to enter up to 100 Zip Codes and keep a count of how many times each one is entered. If a zip code has already been entered it should just add to the count, if it hasn't been entered then it it should add to a list. When the user is done it show a table of all zip codes entered and how many times it was entered. It should also displa how many zips were entered and what percent each of them is of the total number entered. Here is what i have so far....
Code:
// Marketing Department Geographical Distribution Chart
#include <iostream>
#include <new>
using namespace std;
int main ()
{
int i,n;
int * Zips;
cout << "How many Zip Codes would you like to enter? ";
cin >> i;
Zips= new (nothrow) int[i];
if (Zips == 0)
cout << "Error: memory could not be allocated";
else
{
for (n=0; n<i; n++)
{
cout << "Enter Zip Code: ";
cin >> Zips[n];
}
cout << "You have entered: " << i << " Zip Codes." << endl << endl;
cout << "The Zip Codes you have entered are: "<< endl;
for (n=0; n<i; n++)
cout << Zips[n] << ", ";
delete[] Zips;
}
return 0;
}