CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2009
    Posts
    38

    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: *******************

  2. #2
    Join Date
    Jun 2008
    Posts
    592

    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

  3. #3
    Join Date
    Oct 2009
    Posts
    38

    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 &#37; 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?

  4. #4
    Join Date
    Jun 2008
    Posts
    592

    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

  5. #5
    Join Date
    Oct 2009
    Posts
    38

    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
  •  





Click Here to Expand Forum to Full Width

Featured