how to do bar chart in c

Posted by user292489 on Stack Overflow See other posts from Stack Overflow or by user292489
Published on 2010-03-31T02:57:29Z Indexed on 2010/03/31 3:03 UTC
Read the original article Hit count: 317

Filed under:
|
|
i have written a program that prints out the integers in the same order as the input with 5 numbers per line. That is,
the first 5 integers will be printed in the first line; the next 5 integers in the next line; and
so on. 
and also i was trying to print out the numbers in a bar chart formatt:like

81-105 ( 1) x
56-80 ( 5) xxxxx
6-11(5) xxxxx
-1-5 (3) xxx

my program:
 cntr=0;
 while (fscanf(in, "%d", &a[i]) != EOF)
   {i++;

 fprintf(out, "%d-%d (%d) %s\n", A, B, k, x, cntr);
 fprintf(out, "%d\n", k, cntr);

    fprintf(out, "x", a[i]);
    i++;
   }

   fprintf(out, "1864-2336 (%d)%s\n", k, x);
   fprintf(out, "1391-1863 (%d)%s\n", k, x);
   fprintf(out, "918-1390 (%d)%s\n", k, x);
   fprintf(out, "445-917 (%d)%s\n", k, x);
   fprintf(out,"-28-444 (%d)%s\n", k, x);
    fclose(in);
    fclose(out);
return 0;
}

enter code here

© Stack Overflow or respective owner

Related posts about c

    Related posts about home

    • encfs error while decoding the data

      as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
      I have installed encfs and started using it to secure all my personal & office data and it was working absolutely fine until 2 hours back. The setup is like this. I have a folder in Copy folder called OfficeData which gets synchronized with my Copy folder When I login into the system I use… >>> More

    • Magento, NGINX, PHP-FPM, APC, MEMCACHED, 16gb Ram CentOS, Spiking PHP-FPM to 100% CPU

      as seen on Server Fault - Search for 'Server Fault'
      I have been trying to resolve my issue of spiking cpu caused by php-fpm processes. I've reduced the php-fpm config settings to: pm = ondemand pm.max_children = 12 pm.start_servers = 2 pm.min_spare_servers = 2 pm.max_spare_servers = 10 pm.max_requests = 500 php_admin_value[memory_limit] = 128M Problem… >>> More

    • Building Awesome WM

      as seen on Ask Ubuntu - Search for 'Ask Ubuntu'
      Hello, I am following these steps in order to build Awesome window manager on 10.04 I am building 3.4 while the tutorial is for 3.1 I installed all of the specified dependencies including cairo. After running cd awesome-3.4 && make I get the following missing dependencies error: Running… >>> More

    • Building Awesome WM

      as seen on Server Fault - Search for 'Server Fault'
      Hello, I am following these steps in order to build Awesome window manager on 10.04 I am building 3.4 while the tutorial is for 3.1 I installed all of the specified dependencies including cairo. EDIT I ran: sudo apt-get install libxcb-xtest0-dev libxcb-property1-dev libxdg-basedir-dev libstartup-notification0-dev… >>> More

    • Building Awesome WM

      as seen on Super User - Search for 'Super User'
      Hello, I am following these steps in order to build Awesome window manager on 10.04 I am building 3.4 while the tutorial is for 3.1 I installed all of the specified dependencies including cairo. EDIT I ran: sudo apt-get install libxcb-xtest0-dev libxcb-property1-dev libxdg-basedir-dev libstartup-notification0-dev… >>> More