-
Arrays
I am in my first C++ class and we are using the book C++ For business programers. We have just started capter 6 which covers arrays and I am lost The book wants me to write a program that prompts the user to enter the 5-digit zipcode of a customer Store the zip in array of intergers, and store the counts of customers in a corresponding array of intergers Assume a maximum of 100 zips. When a zip is entered the program should search the zip array. If it is not in the array it should add it to the end of the array and set the corresponding count array to one If the zip is already present in the zip array, it should increment the corresponding count array When the user completes entering zips, the program should display a table that lists all the zps with their counts and the percent that is of the total number of customers. The total number of customers should also be displayed.Please help!!!!!!!!
Code:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const int Num_Zips = 10;
const int Num_Members = 20;
int Members[Num_Zips][Num_Members];
int Zipcode,
Member_Count;
cout << setprecision(1)
<< setiosflags(ios::fixed)
<< setiosflags(ios::showpoint);
cout << "nter your Zip Code." << endl;
for (Zipcode = 0; Zipcode < Num_Zips; ++ Zipcode)
{
cout << endl;
cout << "Enter the zip code for each member " << Zipcode + 1 << ": ";
cin >> Zipcode;
}
cout << endl;
cout << "The zip codes you entered were: ";
for (Zipcode = 0; Zipcode < Num_Zips; ++Zipcode)
cout << setw(5) << Zipcode;
return 0;
}
This all I have so far and it isn.t even close.
-
Here you go.
Code:
#include <iostream>
using namespace std;
int main(void) {
}
-
So you read in the zip code. Then you have to store it. So why aren't you? Is there something specific you're confused about?
-