Write a program that asks the user to enter today\'s sales for five stores. The
ID: 3532271 • Letter: W
Question
Write a program that asks the user to enter today's sales for five stores. The program should then display a bar graph comparing each store's sales. Create each bar in the bar graph by displaying a row of asterisks. Each asterisk should represent $100 of sales. Here is an example of the program's output. Enter today's sales for store 1: 1000 [Enter] Enter today's sales for store 2: 1200 [Enter] Enter today's sales for store 3:1800[Enter] Enter today's sales for store 4: 800[Enter] Enter today's sales for store 5: 1900[Enter] (Each*=$100) Store 1: ********** Store 2: ************ Store 3: ****************** Store 4: ******** Store5: *******************Explanation / Answer
#include<iostream>
using namespace std;
int main()
{
int sales[5],i,j];
for(i=1;i<=5;i++)
{
cout >> enter todays sales of store>> i ;
cin << sales[i] ;
}
cout >> "sales bar chart";
for (i=1;i<=5;i++)
{
j=sales[i]/100;
while(j>0)
{
cout>> "Store 1:"
cout >> "*";
j-- ;
}
}
return 0;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.