Answered step by step
Verified Expert Solution
Question
1 Approved Answer
//----------------------------------------------------------- void count_words( void ) { // pre-C99 -- have to write void if no args long nc, nl, nw; int c, state = OUT;
//----------------------------------------------------------- void count_words(void) { // pre-C99 -- have to write void if no args long nc, nl, nw; int c, state = OUT; nc = nl = nw = 0; memset(words, 0, sizeof(words)); while ((c = getchar()) != EOF) { ++nc; if (isalpha(c) || c == '-') { wordbuf[idx++] = c; } if (c == ' ') { ++nl; } if (isspace(c)) { state = OUT; } else if (state == OUT) { state = IN; if (nw > 0) { add_word(); } // don't add entering the first word ++nw; } } if (idx > 0) { // words just before the EOF with no leading whitespace ++idx; add_word(); } printf("%ld chars, %ld words, and %ld lines ", nc, nw, nl); } //----------------------------------------------------------- //----------------------------------------------------------- int main(int argc, const char * argv[]) { // count lines, words, and chars in input count_words(); print_horiz_histogram(); print_vert_histogram(); return 0; }
Create print_horiz_histogram(), print_vet_histogram(), and count_words(), and make sure it is written in C language
input a sentence or a paragraph of words and return how many characters, how many words and how many lines of input and return the biggest word from the paragraph. Example
1673 characters, 276 words, and 7 lines
biggest word: 17 characters
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Saul 9 put 'SPJOM 192 Seu EZT , " pe 1. "" pe 1: : 3:43:57:43:18:11:22:13:14:14:16:37:38:19:24:21:22:23:24 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Saul 9 put 'SPJOM 192 Seu EZT , " pe 1. "" pe 1: : 3:43:57:43:18:11:22:13:14:14:16:37:38:19:24:21:22:23:24Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started