#include #include #include #include int count_paragraph(char text[]) { int paragraph_count=1; int text_len = strlen(text); int consecutive_nl_count = 0; for(int i=0; i=2) { paragraph_count++; consecutive_nl_count = 0; } } else { consecutive_nl_count = 0; } } return paragraph_count; } int count_line(char text[]) { int line_count=1; int text_len = strlen(text); for(int i=0; i 0) // Use stricmp() to sort without sensitivity to case { strcpy(x, sorted_word_list[j]); strcpy(sorted_word_list[j], sorted_word_list[i]); strcpy(sorted_word_list[i], x); } } } } void arrange_word(int word_count) { char * arrange; char row[10][20]; int row_count = ceil(word_count/10.0); arrange = (char*)malloc((row_count) * sizeof(row)); memset(arrange, '\0', sizeof(arrange)); int curr_row = 0, curr_col = 0; for(int i = 0; i< word_count; i++) { char * curr_pointer = arrange+(curr_row * sizeof(row))+(curr_col * sizeof(row[0])); strcpy(curr_pointer, word_list[i]); curr_col++; if (curr_col%10 == 0) { curr_col = 0; curr_row++; } } FILE * output_file; output_file = fopen("op.txt","w"); for (int ii = 0; ii<10; ii++) { for (int jj=0; jj