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