Kalhnyxtakias

Untitled

Jan 14th, 2021
434
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Print synonyms if they are found*/
  2.         if (pointer_array[word_count - 1][1] != NULL) {
  3.  
  4.             if (length + strlen(pointer_array[word_count - 1][1]) + 2 >= linelen) {
  5.                 /* If there is a punctuation mark before line change, switch to uppercase for first letter */
  6.  
  7.                 if (strstr(punctuation, pointer_array[word_count - 2][0]) != NULL) {
  8.                     *(pointer_array[word_count - 1][1]) = toupper( * (pointer_array[word_count - 1][1]));
  9.  
  10.                     printf("\n(%s)", pointer_array[word_count - 1][1]);
  11.  
  12.                     length = strlen(pointer_array[word_count - 1][1]) + 2;
  13.  
  14.                     *(pointer_array[word_count - 1][1]) = tolower( * (pointer_array[word_count - 1][1]));
  15.                 }
  16.                 /* Print word in new line */
  17.                 else {
  18.  
  19.                     printf("\n(%s)", pointer_array[word_count - 1][1]);
  20.  
  21.                     length = strlen(pointer_array[word_count - 1][1]) + 2;
  22.                 }
  23.             }
  24.             /* If previous word is punctuation mark, switch to uppercase for first letter */
  25.             else if (strstr(punctuation, pointer_array[word_count - 2][0]) != NULL) {
  26.                 *(pointer_array[word_count - 1][1]) = toupper( * (pointer_array[word_count - 1][1]));
  27.  
  28.                 printf(" (%s)", pointer_array[word_count - 1][1]);
  29.  
  30.                 length += strlen(pointer_array[word_count - 1][1]) + 3;
  31.  
  32.                 *(pointer_array[word_count - 1][1]) = tolower( * (pointer_array[word_count - 1][1]));
  33.  
  34.             }
  35.             /* Print word */
  36.             else {
  37.                 printf(" (%s)", pointer_array[word_count - 1][1]);
  38.  
  39.                 length += strlen(pointer_array[word_count - 1][1]) + 3;
  40.  
  41.             }
  42.         }
  43.     } while (pointer_array[word_count][0] != NULL && word_count < MAX_WORDS);
  44.  
  45.     printf("\n");
  46.  
  47. }
RAW Paste Data