A
arnuld
i was able to create a solution for a Horizontal-Histogram. i was
completely unable to understand this Vertical-Histogram phenomenon.
even though i have looked at the solution at this page:
http://clc-wiki.net/wiki/K&R2_solutions:Chapter_1:Exercise_13
still i am not able to make sense of many-many things like (on the
same page) for my solution i have written this in documentation,to
give reader some hint about what i thought before coding:
METHOD:
1.) we will count the length of each word by counting the
characters it has.
2.) we use an array where we will keep track of how many words
of a specific length we have encountered.
3.) for simplicity, we will not take into account any words
having more than 10 characters in it. extra characters will
simply be discarded.
*/
and this:
int i = 0;
int j =0; /* i and j are simply index counters */
int c = 0;
int nchar = 0; /* number of characters in a word */
int inspace = IN; /* a flag to know whether we are inside of outside
the word */
int wordlen[MAXLENGTH]; /* counts how many words of a particular
length we have seen */
but the Vertical-Histogram solution doe snot given any hints in
variables. completely alien kind of thing for me. does that mean i
should leave programming and do something else like carpentry or
selling water purifiers :-(
completely unable to understand this Vertical-Histogram phenomenon.
even though i have looked at the solution at this page:
http://clc-wiki.net/wiki/K&R2_solutions:Chapter_1:Exercise_13
still i am not able to make sense of many-many things like (on the
same page) for my solution i have written this in documentation,to
give reader some hint about what i thought before coding:
METHOD:
1.) we will count the length of each word by counting the
characters it has.
2.) we use an array where we will keep track of how many words
of a specific length we have encountered.
3.) for simplicity, we will not take into account any words
having more than 10 characters in it. extra characters will
simply be discarded.
*/
and this:
int i = 0;
int j =0; /* i and j are simply index counters */
int c = 0;
int nchar = 0; /* number of characters in a word */
int inspace = IN; /* a flag to know whether we are inside of outside
the word */
int wordlen[MAXLENGTH]; /* counts how many words of a particular
length we have seen */
but the Vertical-Histogram solution doe snot given any hints in
variables. completely alien kind of thing for me. does that mean i
should leave programming and do something else like carpentry or
selling water purifiers :-(