Thread: Horizontal bar Graph?

  1. #1
    robjules
    Guest

    Talking Horizontal bar Graph?

    How do you make a horizontal bar graph. The user will input 4 numbers and they will show up accordingly on the graph. I am really stuck so if someone can help I would appreciate it

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>> How do you make a horizontal bar graph.

    On what and with what OS?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    17

    Horizontal bar Graph

    This is what I have to do. I know bsically how to do the coding for it all except the graph. It is on Microsoft C++ version 6.0.


    Create a program that takes 4 positive numeric values(North, East, South, West) as input from the user and creates a horizontal bar graph. The bars will consist of a given number of symbols (i.e. *) used to denote the entered quantity. For example, if the user enters 12, the bar will be a series of 12 *. The numbers may be decimal, but they will need to be rounded. So, you will create a function to facilitate rounding.

    Also, you must use error checking to ensure the user enters a positive numeric value. An appropriate error message must be displayed to the user, should an error be detected.

    The mean of the 4 values must be calculated and displayed below the bar graph in a summary section. The bar graph must have both an x-axis and y-axis with labels for the y-axis and a numeric scale on the x-axis. In addition, you will want to provide the exact value at the end of each bar.

    test data:
    220,5,3.14,1
    -10,-1,.49,.50
    3.5,1.2,4.6,W
    -.01,0,.99,.01
    3.51,4.99,south,1.99

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    Okay, we're getting a bit nearer. So is this to show in a window, (use TextOut()), or a console, (use printf() or cout)?
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    155
    a single bar graph using 1 * to represent 1 item in text mode:

    int num = 4;
    int i;
    for(i = 0; i < num; i++)
    cout << '*';

    To do a series of bar graphs use an array to hold all numbers to be represented in the graph and nested loops to "draw" the bars

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need help with sin(x) and bar graph
    By SuPaNooB in forum C Programming
    Replies: 6
    Last Post: 10-07-2007, 01:01 AM
  2. error help making no sense
    By tunerfreak in forum C++ Programming
    Replies: 5
    Last Post: 04-17-2007, 07:55 PM
  3. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 01:32 PM
  4. List box horizontal bar
    By cfriend in forum Windows Programming
    Replies: 1
    Last Post: 09-12-2004, 03:52 PM
  5. Enabling horizontal scroll bar in dialog list box
    By bennyandthejets in forum Windows Programming
    Replies: 0
    Last Post: 06-03-2004, 06:54 PM