Bar charts with for loop?
Hi guys, how do i make a bar chart with the for loop where each asterisk represents 100 after the user inputs the numbers?
inputs
store1=1000
store2=1200
store3=1800
store4=800
store5=1900
and the bar chart should show like this ( 1 asterisk = 100 )
store1: **********
store2: ************
store3: ******************
store4: ********
store5: *******************
Re: Bar charts with for loop?
double posting isn't going to help. this is spamming.
http://www.codeguru.com/forum/showthread.php?t=488650 <--- back to the original post
Re: Bar charts with for loop?
the other one wasnt as descriptive...
Code:
#include<iomanip>
using namespace std;
int main()
{
int store1, store2, store3, store4, store5;
cout << "Enter today's sales for store 1.\n";
cout << "Enter a value between 0 and 4000: ";
cin >> store1;
while ( store1 % 100 != 0 || store1 < 0 || store1 > 4000 )
{
cout << "Invalid sales amount: " << store1 << endl;
cout << "Sales must be multiple of 100 in range 0-4000, inclusive.\n";
cout << "Enter today's sales for store 1.";
cin >> store1;
}
cout << "Enter the sales for store 2.";
cin >> store2;
while ( store2 % 100 != 0 || store2 < 0 || store2 > 4000 )
{
cout << "Invalid sales amount: " << store2 << endl;
cout << "Sales must be multiple of 100 in range 0-4000, inclusive.\n";
cout << "Enter today's sales for store 2.";
cin >> store2;
}
cout << "Enter the sales for store 3.";
cin >> store3;
while ( store3 % 100 != 0 || store3 < 0 || store3 > 4000 )
{
cout << "Invalid sales amount: " << store3 << endl;
cout << "Sales must be multiple of 100 in range 0-4000, inclusive.\n";
cout << "Enter today's sales for store 3.";
cin >> store3;
}
cout << "Enter the sales for store 4.";
cin >> store4;
while ( store4 % 100 != 0 || store4 < 0 || store4 > 4000 )
{
cout << "Invalid sales amount: " << store4 << endl;
cout << "Sales must be multiple of 100 in range 0-4000, inclusive.\n";
cout << "Enter today's sales for store 4.";
cin >> store4;
}
cout << "Enter the sales for store 5.";
cin >> store5;
while ( store5 % 100 != 0 || store5 < 0 || store5 > 4000 )
{
cout << "Invalid sales amount: " << store5 << endl;
cout << "Sales must be multiple of 100 in range 0-4000, inclusive.\n";
cout << "Enter today's sales for store 5.";
cin >> store5;
}
i just dont know how to do the bar chart..someone help please?
Re: Bar charts with for loop?
doesn't matter. it is the same question
double posting isn't going to help. this is spamming.
http://www.codeguru.com/forum/showthread.php?t=488650 <--- back to the original post
i can't help you in 2 different threads that are the same.
Re: Bar charts with for loop?
you weren't helping period. im reading starting out with c++ by tony gaddis in the "for statement" section and i dont see anything. Please do not reply to my thread anymore if you are not going to try to help Joeman.