The B histogram package gives the B programmer a convenient method of displaying data on the frequency of occurrence of certain events. Six functions may be called.
The histogram package is included as part of the standard B library. The package uses the external ".histc" to define the character for printing the bar graph. The default character is ']'. The user may change this character by changing the value of ".histc".
The following is a program to gather a histogram of the line lengths in a file:
main() {
auto hg,in[64];
hg = histinit(1);
while( getstr(in)>0 ) histogram( hg,length(in) );
histprint( hg,1,"line lengths" );
histdestroy(hg);
}
Copyright © 1996, Thinkage Ltd.