|
-
November 23rd, 2009, 07:42 PM
#1
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: *******************
-
November 23rd, 2009, 07:46 PM
#2
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
0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000 0000 0000 0000 0000
-
November 23rd, 2009, 08:21 PM
#3
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?
-
November 23rd, 2009, 08:28 PM
#4
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.
0100 0111 0110 1111 0110 0100 0010 0000 0110 1001 0111 0011 0010 0000 0110 0110 0110 1111 0111 0010
0110 0101 0111 0110 0110 0101 0111 0010 0010 0001 0010 0001 0000 0000 0000 0000 0000 0000 0000 0000
-
November 24th, 2009, 01:19 AM
#5
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.
Last edited by Sabensohn70; November 24th, 2009 at 01:34 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|