Hello, I'm having some problems writing this program. I'm supposed to display a graph that compares the store's sales. I've almost finished it, but when I go to run the program the stars wouldn't show up.
#include <iostream>
usingnamespace std;
int main()
{
double sales; //today's sales for five stores
char star = '*';
cout << " Enter today's sales for five different stores." << endl;
for(int count = 1; count <= 5; count++)
{
cout << "\n Enter today's sales for store " << count << ":";
cin >> sales;
}
cout << "\n SALES BAR GRAPH" << endl;
cout << " (Each * = $100)" << endl;
for( int count = 1; count <= 5; count++)
{
star = 100;
star /= sales;
cout << "Store " << count << ": " << star << endl;
}
return 0;
}
The part with the SALES BAR GRAPH is supposed to display like this:
1 2 3 4 5 6 7
SALES BAR CHART
(Each * = $100)
Store 1: *************
Store 2: ***************
Store 3: ********************
Store 4: ********
Store 5: *********************
sales needs to save the sales for each store. This could be done by changing sales to an array, vector or map of doubles. The number of stars to print should be sales/100 = numStars. To create the output of stars you could use a string with the assign function.